all install depend clean:
cd ./pm && $(MAKE) $@
cd ./fs && $(MAKE) $@
+ cd ./sm && $(MAKE) $@
cd ./is && $(MAKE) $@
cd ./init && $(MAKE) $@
cd ./inet && $(MAKE) $@
#define NOT_REVIVING 0 /* process is not being revived */
#define REVIVING 1 /* process is being revived from suspension */
#define PID_FREE 0 /* process slot free */
-#define PID_SERVER (-1) /* process has become a server */
/* Check is process number is acceptable - includes system processes. */
#define isokprocnr(n) ((unsigned)((n)+NR_TASKS) < NR_PROCS + NR_TASKS)
}
}
- /* Truly exiting, or becoming a server? */
+ /* Mark slot as free. */
fp->fp_pid = PID_FREE;
return(OK);
}
register struct proc *rp;
static struct proc *oldrp = BEG_PROC_ADDR;
register struct priv *sp;
+ static char send_mask[NR_SYS_PROCS + 1 + NR_SYS_PROCS/8];
int r, i,j, n = 0;
/* First obtain a fresh copy of the current process and system table. */
return;
}
- printf("\n--nr-id-name--- -flags- -sc-\n");
+ printf("\n--nr-id-name--- -flags- -sc- -send mask-\n");
for (rp = oldrp; rp < END_PROC_ADDR; rp++) {
if (isemptyp(rp)) continue;
if (r == -1 && ! (rp->p_rts_flags & SLOT_FREE)) {
sp = &priv[USER_PRIV_ID];
}
- printf("(%02u) %-7.7s 0x%02x %02.2u",
+ printf("(%02u) %-7.7s 0x%02x %02.2u ",
sp->s_id, rp->p_name,
sp->s_flags, sp->s_call_mask
);
- printf("\n");
+ for (i=j=0; i < NR_SYS_PROCS; i++, j++) {
+ send_mask[j] = get_sys_bit(sp->s_send_mask, i) ? '1' : '0';
+ if (i % 8 == 7) send_mask[++j] = ' ';
+ }
+ send_mask[j] = '\0';
+
+ printf(" %s \n", send_mask);
}
if (rp == END_PROC_ADDR) rp = BEG_PROC_ADDR; else printf("--more--\r");
oldrp = rp;
case SYS_EVENT:
sigset = (sigset_t) m_in.NOTIFY_ARG;
if (sigismember(&sigset, SIGTERM)) {
+ exit(3);
/* nothing to do on shutdown */
}
if (sigismember(&sigset, SIGKSTOP)) {
clock_t t[5];
proc_nr = (int) (rmp - mproc); /* get process slot number */
- DEBUG(proc_nr == PRINTER, printf("PM: printer about to die ...\n"));
/* Remember a session leader's process group. */
procgrp = (rmp->mp_pid == mp->mp_procgrp) ? mp->mp_procgrp : 0;
p_mp->mp_child_stime += t[1] + rmp->mp_child_stime; /* add system time */
/* Tell the kernel and FS that the process is no longer runnable. */
- DEBUG(proc_nr == PRINTER, printf("PM: telling FS and kernel about xit...\n"));
tell_fs(EXIT, proc_nr, 0, 0); /* file system can free the proc slot */
sys_exit(proc_nr);
pidarg = p_mp->mp_wpid; /* who's being waited for? */
parent_waiting = p_mp->mp_flags & WAITING;
- DEBUG(proc_nr == PRINTER, printf("PM: parent waiting %d, for %d...\n", parent_waiting, pidarg));
-
right_child = /* child meets one of the 3 tests? */
(pidarg == -1 || pidarg == rmp->mp_pid || -pidarg == rmp->mp_procgrp);
if (parent_waiting && right_child) {
- DEBUG(proc_nr == PRINTER, printf("PM: parent waiting, release slot...\n"));
cleanup(rmp); /* tell parent and release child slot */
} else {
- DEBUG(proc_nr == PRINTER, printf("PM: parent not waiting, zombify ...\n"));
rmp->mp_flags = IN_USE|ZOMBIE; /* parent not waiting, zombify child */
sig_proc(p_mp, SIGCHLD); /* send parent a "child died" signal */
}
rmp->mp_pid = INIT_PID;
rmp->mp_parent = PM_PROC_NR;
rmp->mp_flags |= IN_USE;
- sigemptyset(&rmp->mp_ignore);
rmp->mp_nice = 0;
+ sigemptyset(&rmp->mp_ignore);
}
else { /* system process */
rmp->mp_pid = get_free_pid();
- rmp->mp_parent = INIT_PROC_NR;
+ rmp->mp_parent = SM_PROC_NR;
rmp->mp_flags |= IN_USE | DONT_SWAP | PRIV_PROC;
- sigfillset(&rmp->mp_ignore);
+ sigfillset(&rmp->mp_ignore);
}
sigemptyset(&rmp->mp_sigmask);
sigemptyset(&rmp->mp_catch);
}
/* PM is somewhat special. Override some details. */
- mproc[PM_PROC_NR].mp_pid = PM_PID;
- mproc[PM_PROC_NR].mp_parent = PM_PROC_NR;
+ sigfillset(&mproc[PM_PROC_NR].mp_ignore); /* guard against signals */
+ mproc[PM_PROC_NR].mp_pid = PM_PID; /* magically override pid */
+ mproc[PM_PROC_NR].mp_parent = PM_PROC_NR; /* PM doesn't have parent */
+
/* Tell FS that no more system processes follow and synchronize. */
mess.PR_PROC_NR = NONE;
slot = (int) (rmp - mproc);
if ((rmp->mp_flags & (IN_USE | ZOMBIE)) != IN_USE) {
printf("PM: signal %d sent to %s process %d\n",
- (rmp->mp_flags & ZOMBIE) ? "zombie" : "dead", signo, slot);
+ signo, (rmp->mp_flags & ZOMBIE) ? "zombie" : "dead", slot);
panic(__FILE__,"", NO_NUM);
}
if ((rmp->mp_flags & TRACED) && signo != SIGKILL) {