VM: full munmap
[minix.git] / lib / libsys / sys_getinfo.c
blob5ec1ee37ce5307f0dbdc65445f7999da5c64163d
2 #include <string.h>
3 #include <sys/param.h>
4 #include "syslib.h"
6 /*===========================================================================*
7 * sys_getinfo *
8 *===========================================================================*/
9 int sys_getinfo(request, ptr, len, ptr2, len2)
10 int request; /* system info requested */
11 void *ptr; /* pointer where to store it */
12 int len; /* max length of value to get */
13 void *ptr2; /* second pointer */
14 int len2; /* length or process nr */
16 message m;
18 m.I_REQUEST = request;
19 m.I_ENDPT = SELF; /* always store values at caller */
20 m.I_VAL_PTR = ptr;
21 m.I_VAL_LEN = len;
22 m.I_VAL_PTR2 = ptr2;
23 m.I_VAL_LEN2_E = len2;
25 return(_kernel_call(SYS_GETINFO, &m));
28 /*===========================================================================*
29 * sys_whoami *
30 *===========================================================================*/
31 int sys_whoami(endpoint_t *who_ep, char *who_name, int len,
32 int *priv_flags)
34 message m;
35 int r;
36 int lenmin;
38 m.I_REQUEST = GET_WHOAMI;
40 if(len < 2)
41 return EINVAL;
43 if((r = _kernel_call(SYS_GETINFO, &m)) != OK)
44 return r;
46 lenmin = MIN((size_t) len, sizeof(m.GIWHO_NAME)) - 1;
48 strncpy(who_name, m.GIWHO_NAME, lenmin);
49 who_name[lenmin] = '\0';
50 *who_ep = m.GIWHO_EP;
51 *priv_flags = m.GIWHO_PRIVFLAGS;
53 return OK;