. check for notify() from NONE (shouldn't happen any more)

. test for cleared process slots when checking processes on exiting
 . clear process slot first, then do cleanup on exiting
This commit is contained in:
Ben Gras 2005-10-20 20:59:02 +00:00
parent f7f30a3a44
commit cf16c73e62
2 changed files with 22 additions and 9 deletions

View file

@ -349,6 +349,11 @@ unsigned flags; /* system call flags */
src_id = (chunk - &map->chunk[0]) * BITCHUNK_BITS + i;
if (src_id >= NR_SYS_PROCS) break; /* out of range */
src_proc_nr = id_to_nr(src_id); /* get source proc */
#if DEBUG_ENABLE_IPC_WARNINGS
if(src_proc_nr == NONE) {
kprintf("mini_receive: sending notify from NONE\n");
}
#endif
if (src!=ANY && src!=src_proc_nr) continue; /* source not ok */
*chunk &= ~(1 << i); /* no longer pending */

View file

@ -49,6 +49,11 @@ register struct proc *rc; /* slot of process to clean up */
register struct proc *rp; /* iterate over process table */
register struct proc **xpp; /* iterate over caller queue */
int i;
int sys_id;
char rts_flags;
/* Don't clear if already cleared. */
if(isemptyp(rc)) return;
/* Turn off any alarm timers at the clock. */
reset_timer(&priv(rc)->s_alarm_timer);
@ -56,11 +61,20 @@ register struct proc *rc; /* slot of process to clean up */
/* Make sure that the exiting process is no longer scheduled. */
if (rc->p_rts_flags == 0) lock_dequeue(rc);
/* Release the process table slot. If this is a system process, also
* release its privilege structure. Further cleanup is not needed at
* this point. All important fields are reinitialized when the
* slots are assigned to another, new process.
*/
rts_flags = rc->p_rts_flags;
rc->p_rts_flags = SLOT_FREE;
if (priv(rc)->s_flags & SYS_PROC) priv(rc)->s_proc_nr = NONE;
/* If the process being terminated happens to be queued trying to send a
* message (e.g., the process was killed by a signal, rather than it doing
* a normal exit), then it must be removed from the message queues.
*/
if (rc->p_rts_flags & SENDING) {
if (rts_flags & SENDING) {
xpp = &proc[rc->p_sendto].p_caller_q; /* destination's queue */
while (*xpp != NIL_PROC) { /* check entire queue */
if (*xpp == rc) { /* process is on the queue */
@ -80,6 +94,8 @@ register struct proc *rc; /* slot of process to clean up */
* Check all processes.
*/
for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; rp++) {
if(isemptyp(rp))
continue;
/* Unset pending notification bits. */
unset_sys_bit(priv(rp)->s_notify_pending, priv(rc)->s_id);
@ -114,14 +130,6 @@ register struct proc *rc; /* slot of process to clean up */
/* Clean up virtual memory */
if (rc->p_misc_flags & MF_VM)
vm_map_default(rc);
/* Now it is safe to release the process table slot. If this is a system
* process, also release its privilege structure. Further cleanup is not
* needed at this point. All important fields are reinitialized when the
* slots are assigned to another, new process.
*/
rc->p_rts_flags = SLOT_FREE;
if (priv(rc)->s_flags & SYS_PROC) priv(rc)->s_proc_nr = NONE;
}
#endif /* USE_EXIT */