VM: full munmap
[minix.git] / lib / libsys / sys_safemap.c
blobe3d3d111feb83f92934469982b2c8b3267e3e4f9
2 #include "syslib.h"
4 #include <minix/safecopies.h>
6 /*===========================================================================*
7 * sys_safemap *
8 *===========================================================================*/
9 int sys_safemap(endpoint_t grantor, cp_grant_id_t grant,
10 vir_bytes grant_offset, vir_bytes my_address,
11 size_t bytes, int writable)
13 /* Map a block of data for which the other process has previously
14 * granted permission.
17 message copy_mess;
19 copy_mess.SMAP_EP = grantor;
20 copy_mess.SMAP_GID = grant;
21 copy_mess.SMAP_OFFSET = grant_offset;
22 copy_mess.SMAP_ADDRESS = my_address;
23 copy_mess.SMAP_BYTES = bytes;
24 copy_mess.SMAP_FLAG = writable;
26 copy_mess.SMAP_SEG_OBSOLETE = (void *) D_OBSOLETE;
28 return(_kernel_call(SYS_SAFEMAP, &copy_mess));
32 /*===========================================================================*
33 * sys_saferevmap_gid *
34 *===========================================================================*/
35 int sys_saferevmap_gid(cp_grant_id_t grant)
37 /* Grantor revokes safemap by grant id. */
38 message copy_mess;
40 copy_mess.SMAP_FLAG = 1;
41 copy_mess.SMAP_GID = grant;
43 return(_kernel_call(SYS_SAFEREVMAP, &copy_mess));
46 /*===========================================================================*
47 * sys_saferevmap_addr *
48 *===========================================================================*/
49 int sys_saferevmap_addr(vir_bytes addr)
51 /* Grantor revokes safemap by address. */
52 message copy_mess;
54 copy_mess.SMAP_FLAG = 0;
55 copy_mess.SMAP_GID = addr;
57 return(_kernel_call(SYS_SAFEREVMAP, &copy_mess));
60 /*===========================================================================*
61 * sys_safeunmap *
62 *===========================================================================*/
63 int sys_safeunmap(vir_bytes my_address)
65 /* Requestor unmaps safemap. */
66 message copy_mess;
68 copy_mess.SMAP_ADDRESS = my_address;
70 copy_mess.SMAP_SEG_OBSOLETE = (void *) D_OBSOLETE;
72 return(_kernel_call(SYS_SAFEUNMAP, &copy_mess));