panic() cleanup.
[minix.git] / lib / libsys / sys_getinfo.c
blob5a87a786dffaac786761373f36fe98105ba7f00a
2 #include <string.h>
4 #include "syslib.h"
6 /*===========================================================================*
7 * sys_getinfo *
8 *===========================================================================*/
9 PUBLIC 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 PUBLIC int sys_whoami(endpoint_t *who_ep, char *who_name, int len)
33 message m;
34 int r;
35 int lenmin;
37 m.I_REQUEST = GET_WHOAMI;
39 if(len < 2)
40 return EINVAL;
42 if((r = _kernel_call(SYS_GETINFO, &m)) != OK)
43 return r;
45 lenmin = MIN(len, sizeof(m.GIWHO_NAME)) - 1;
47 strncpy(who_name, m.GIWHO_NAME, lenmin);
48 who_name[lenmin] = '\0';
49 *who_ep = m.GIWHO_EP;
51 return OK;