2008-11-19 13:26:10 +01:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
#include "syslib.h"
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* sys_getinfo *
|
|
|
|
*===========================================================================*/
|
2005-07-19 14:24:51 +02:00
|
|
|
PUBLIC int sys_getinfo(request, ptr, len, ptr2, len2)
|
2005-04-21 16:53:53 +02:00
|
|
|
int request; /* system info requested */
|
2005-07-19 14:24:51 +02:00
|
|
|
void *ptr; /* pointer where to store it */
|
|
|
|
int len; /* max length of value to get */
|
|
|
|
void *ptr2; /* second pointer */
|
|
|
|
int len2; /* length or process nr */
|
2005-04-21 16:53:53 +02:00
|
|
|
{
|
|
|
|
message m;
|
|
|
|
|
|
|
|
m.I_REQUEST = request;
|
2006-03-03 10:44:55 +01:00
|
|
|
m.I_ENDPT = SELF; /* always store values at caller */
|
2005-07-19 14:24:51 +02:00
|
|
|
m.I_VAL_PTR = ptr;
|
|
|
|
m.I_VAL_LEN = len;
|
|
|
|
m.I_VAL_PTR2 = ptr2;
|
2006-03-03 10:44:55 +01:00
|
|
|
m.I_VAL_LEN2_E = len2;
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
return(_taskcall(SYSTASK, SYS_GETINFO, &m));
|
|
|
|
}
|
|
|
|
|
2008-11-19 13:26:10 +01:00
|
|
|
/*===========================================================================*
|
|
|
|
* sys_whoami *
|
|
|
|
*===========================================================================*/
|
|
|
|
PUBLIC int sys_whoami(endpoint_t *who_ep, char *who_name, int len)
|
|
|
|
{
|
|
|
|
message m;
|
|
|
|
int r;
|
|
|
|
int lenmin;
|
|
|
|
|
|
|
|
m.I_REQUEST = GET_WHOAMI;
|
|
|
|
|
|
|
|
if(len < 2)
|
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
if((r = _taskcall(SYSTASK, SYS_GETINFO, &m)) != OK)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
lenmin = MIN(len, sizeof(m.GIWHO_NAME)) - 1;
|
|
|
|
|
|
|
|
strncpy(who_name, m.GIWHO_NAME, lenmin);
|
|
|
|
who_name[lenmin] = '\0';
|
|
|
|
*who_ep = m.GIWHO_EP;
|
|
|
|
|
|
|
|
return OK;
|
|
|
|
}
|
2005-04-21 16:53:53 +02:00
|
|
|
|