Basic VM and other minor improvements.
Not complete, probably not fully debugged or optimized.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "syslib.h"
|
||||
|
||||
/*===========================================================================*
|
||||
@@ -22,4 +25,29 @@ int len2; /* length or process nr */
|
||||
return(_taskcall(SYSTASK, SYS_GETINFO, &m));
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user