xref: /minix/minix/kernel/system/do_setgrant.c (revision 7f5f010b)
1 /* The kernel call implemented in this file:
2  *   m_type:	SYS_SETGRANT
3  *
4  * The parameters for this kernel call are:
5  *   m_lsys_krn_sys_setgrant.addr    address of grant table in own address space
6  *   m_lsys_krn_sys_setgrant.size    number of entries
7  */
8 
9 #include "kernel/system.h"
10 #include <minix/safecopies.h>
11 
12 /*===========================================================================*
13  *				do_setgrant				     *
14  *===========================================================================*/
15 int do_setgrant(struct proc * caller, message * m_ptr)
16 {
17 	int r;
18 
19 	/* Copy grant table set in priv. struct. */
20 	if (RTS_ISSET(caller, RTS_NO_PRIV) || !(priv(caller))) {
21 		r = EPERM;
22 	} else {
23 		_K_SET_GRANT_TABLE(caller,
24 			m_ptr->m_lsys_krn_sys_setgrant.addr,
25 			m_ptr->m_lsys_krn_sys_setgrant.size);
26 		r = OK;
27 	}
28 
29 	return r;
30 }
31