For /dev/mem, map in memory to be copied to memory's own address space
[minix3.git] / kernel / system / do_setgrant.c
blob39044bab478a93987369347721a5c427c53d894a
1 /* The kernel call implemented in this file:
2 * m_type: SYS_SETGRANT
4 * The parameters for this kernel call are:
5 * SG_ADDR address of grant table in own address space
6 * SG_SIZE number of entries
7 */
9 #include "../system.h"
10 #include <minix/safecopies.h>
12 /*===========================================================================*
13 * do_setgrant *
14 *===========================================================================*/
15 PUBLIC int do_setgrant(m_ptr)
16 message *m_ptr;
18 struct proc *rp;
19 int r;
21 /* Who wants to set a parameter? */
22 rp = proc_addr(who_p);
24 /* Copy grant table set in priv. struct. */
25 if (RTS_ISSET(rp, NO_PRIV) || !(priv(rp))) {
26 r = EPERM;
27 } else {
28 _K_SET_GRANT_TABLE(rp,
29 (vir_bytes) m_ptr->SG_ADDR,
30 m_ptr->SG_SIZE);
31 r = OK;
34 return r;