Add support for init flags.
Change-Id: Ibb4d7eb9064d2bbee6d51112ad0c56b2750a5f8e
typedef struct {
endpoint_t endpt;
int privflags;
- char name[48];
+ int initflags;
+ char name[44];
} mess_krn_lsys_sys_getwhoami;
_ASSERT_MSG_SIZE(mess_krn_lsys_sys_getwhoami);
#define USR_F (BILLABLE | PREEMPTIBLE) /* user processes */
#define IMM_F (ROOT_SYS_PROC | VM_SYS_PROC | PREEMPTIBLE) /* immutable */
+/* init flags */
+#define TSK_I 0 /* all kernel tasks */
+#define SRV_I 0 /* system services */
+#define DSRV_I 0 /* dynamic system services */
+#define USR_I 0 /* user processes */
+
/* allowed traps */
#define CSK_T (1 << RECEIVE) /* clock and system */
#define TSK_T 0 /* other kernel tasks */
int sys_getinfo(int request, void *val_ptr, int val_len, void *val_ptr2,
int val_len2);
int sys_whoami(endpoint_t *ep, char *name, int namelen, int
- *priv_flags);
+ *priv_flags, int* init_flags);
/* Signal control. */
int sys_kill(endpoint_t proc_ep, int sig);
else if(iskerneln(proc_nr)) {
/* Privilege flags. */
priv(rp)->s_flags = (proc_nr == IDLE ? IDL_F : TSK_F);
+ /* Init flags. */
+ priv(rp)->s_init_flags = TSK_I;
/* Allowed traps. */
priv(rp)->s_trap_mask = (proc_nr == CLOCK
|| proc_nr == SYSTEM ? CSK_T : TSK_T);
else {
assert(isrootsysn(proc_nr));
priv(rp)->s_flags= RSYS_F; /* privilege flags */
+ priv(rp)->s_init_flags = SRV_I; /* init flags */
priv(rp)->s_trap_mask= SRV_T; /* allowed traps */
ipc_to_m = SRV_M; /* allowed targets */
kcalls = SRV_KC; /* allowed kernel calls */
proc_nr_t s_proc_nr; /* number of associated process */
sys_id_t s_id; /* index of this system structure */
short s_flags; /* PREEMTIBLE, BILLABLE, etc. */
+ int s_init_flags; /* initialization flags given to the process. */
/* Asynchronous sends */
vir_bytes s_asyntab; /* addr. of table in process' address space */
* Upon return of the GETWHOAMI request the following parameters are used:
* m_krn_lsys_sys_getwhoami.endpt (the caller endpoint)
* m_krn_lsys_sys_getwhoami.privflags (the caller priviledes)
+ * m_krn_lsys_sys_getwhoami.initflags (the caller initflags)
* m_krn_lsys_sys_getwhoami.name (the caller process name)
*
*/
strncpy(m_ptr->m_krn_lsys_sys_getwhoami.name, caller->p_name, len);
m_ptr->m_krn_lsys_sys_getwhoami.name[len] = '\0';
m_ptr->m_krn_lsys_sys_getwhoami.privflags = priv(caller)->s_flags;
+ m_ptr->m_krn_lsys_sys_getwhoami.initflags = priv(caller)->s_init_flags;
return OK;
}
case GET_MONPARAMS: {
/* Set defaults for privilege bitmaps. */
priv(rp)->s_flags= DSRV_F; /* privilege flags */
+ priv(rp)->s_init_flags= DSRV_I; /* initialization flags */
priv(rp)->s_trap_mask= DSRV_T; /* allowed traps */
memset(&map, 0, sizeof(map));
ipc_to_m = DSRV_M; /* allowed targets */
int i;
- /* Copy s_flags and signal managers. */
+ /* Copy flags and signal managers. */
priv(rp)->s_flags = priv->s_flags;
+ priv(rp)->s_init_flags = priv->s_init_flags;
priv(rp)->s_sig_mgr = priv->s_sig_mgr;
priv(rp)->s_bak_sig_mgr = priv->s_bak_sig_mgr;
endpoint_t me = NONE;
char name[20];
int priv_flags;
+ int init_flags;
void (*suicide)(void);
va_list args;
- if(sys_whoami(&me, name, sizeof(name), &priv_flags) == OK && me != NONE)
+ if(sys_whoami(&me, name, sizeof(name), &priv_flags, &init_flags) == OK && me != NONE)
printf("%s(%d): panic: ", name, me);
else
printf("(sys_whoami failed): panic: ");
int r, status;
endpoint_t old_endpoint;
int priv_flags;
+ int init_flags;
/* Get information about self. */
r = sys_whoami(&sef_self_endpoint, sef_self_name, SEF_SELF_NAME_MAXLEN,
- &priv_flags);
+ &priv_flags, &init_flags);
if ( r != OK) {
- sef_self_endpoint = SELF;
- strlcpy(sef_self_name, "Unknown", sizeof(sef_self_name));
+ panic("sef_startup: sys_whoami failed: %d\n", r);
}
sef_self_priv_flags = priv_flags;
old_endpoint = NONE;
* sys_whoami *
*===========================================================================*/
int sys_whoami(endpoint_t *who_ep, char *who_name, int len,
- int *priv_flags)
+ int *priv_flags, int *init_flags)
{
message m;
int r;
who_name[lenmin] = '\0';
*who_ep = m.m_krn_lsys_sys_getwhoami.endpt;
*priv_flags = m.m_krn_lsys_sys_getwhoami.privflags;
+ *init_flags = m.m_krn_lsys_sys_getwhoami.initflags;
return OK;
}