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 */
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);
/* 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 */
* 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);
/* 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 */