Various fixes and improvements.
- fixed bug that caused IDLE to panic (irq hook inconsistency); - kprintf() now accepts multiple arguments; moved to utility.c; - prepare_shutdown() signals system processes with SIGKSTOP; - phys_fill() renamed to phys_memset(), argument order changed; - kmemset() removed in favor of phys_kmemset(); - kstrncpy() removed in favor of phys_copy(); - katoi, kstrncmp replaced by normal library procedure again; - rm_irq_handler() interface changed (simply pass hook pointer);
This commit is contained in:
@@ -92,7 +92,7 @@ PUBLIC void sys_task()
|
||||
if (result != EDONTREPLY) {
|
||||
m.m_type = result; /* report status of call */
|
||||
if (OK != lock_send(m.m_source, &m)) {
|
||||
kprintf("Warning, SYSTASK couldn't reply to request from %d\n",
|
||||
kprintf("Warning, SYSTASK couldn't reply to request from %d.\n",
|
||||
m.m_source);
|
||||
}
|
||||
}
|
||||
@@ -171,34 +171,36 @@ PRIVATE void initialize(void)
|
||||
/*===========================================================================*
|
||||
* init_proc *
|
||||
*===========================================================================*/
|
||||
PUBLIC int init_proc(proc_nr, proto_nr)
|
||||
int proc_nr; /* slot of process to initialize */
|
||||
int proto_nr; /* prototype process to copy from */
|
||||
PUBLIC int init_proc(rc, rp)
|
||||
register struct proc *rc; /* new (child) process pointer */
|
||||
struct proc *rp; /* prototype (parent) process */
|
||||
{
|
||||
register struct proc *rc, *rp;
|
||||
register struct priv *sp;
|
||||
register struct priv *sp; /* process' privilege structure */
|
||||
int i;
|
||||
|
||||
/* Get a pointer to the process to initialize. */
|
||||
rc = proc_addr(proc_nr);
|
||||
|
||||
/* If there is a prototype process to initialize from, use it. Otherwise,
|
||||
* assume the caller will take care of initialization, but make sure that
|
||||
* the new process gets a pointer to a system properties structure.
|
||||
*/
|
||||
if (isokprocn(proto_nr)) {
|
||||
kprintf("INIT proc from prototype %d\n", proto_nr);
|
||||
|
||||
} else {
|
||||
if (rp == NIL_PROC) { /* new user process */
|
||||
kprintf("init_proc() for new user proc %d\n", proc_nr(rc));
|
||||
sp = &priv[USER_PRIV_ID];
|
||||
sp->s_proc_nr = ANY; /* misuse for users */
|
||||
rc->p_priv = sp; /* assign to process */
|
||||
return(OK);
|
||||
} else if (rp == NIL_SYS_PROC) { /* new system process */
|
||||
for (sp = BEG_PRIV_ADDR, i = 0; sp < END_PRIV_ADDR; ++sp, ++i) {
|
||||
if (sp->s_proc_nr == NONE) { /* found free slot */
|
||||
sp->s_proc_nr = proc_nr; /* set association */
|
||||
sp->s_proc_nr = proc_nr(rc); /* set association */
|
||||
rc->p_priv = sp; /* assign to process */
|
||||
return(OK);
|
||||
}
|
||||
}
|
||||
kprintf("No free PRIV structure!\n", NO_NUM);
|
||||
return(ENOSPC); /* out of resources */
|
||||
} else { /* forked process */
|
||||
|
||||
kprintf("init_proc() from prototype %d\n", proc_nr(rp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,26 +208,22 @@ int proto_nr; /* prototype process to copy from */
|
||||
/*===========================================================================*
|
||||
* clear_proc *
|
||||
*===========================================================================*/
|
||||
PUBLIC void clear_proc(proc_nr)
|
||||
int proc_nr; /* slot of process to clean up */
|
||||
PUBLIC void clear_proc(rc)
|
||||
register struct proc *rc; /* slot of process to clean up */
|
||||
{
|
||||
register struct proc *rp, *rc;
|
||||
register struct proc *rp; /* iterate over process table */
|
||||
register struct proc **xpp; /* iterate over caller queue */
|
||||
int i;
|
||||
|
||||
/* Get a pointer to the process that exited. */
|
||||
rc = proc_addr(proc_nr);
|
||||
|
||||
/* Turn off any alarm timers at the clock. */
|
||||
reset_timer(&priv(rc)->s_alarm_timer);
|
||||
|
||||
/* Make sure the exiting process is no longer scheduled. */
|
||||
/* Make sure that the exiting process is no longer scheduled. */
|
||||
if (rc->p_rts_flags == 0) lock_unready(rc);
|
||||
|
||||
/* 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
|
||||
* an exit or it is forcibly shutdown in the stop sequence), then it must
|
||||
* be removed from the message queues.
|
||||
* a normal exit), then it must be removed from the message queues.
|
||||
*/
|
||||
if (rc->p_rts_flags & SENDING) {
|
||||
/* Check all proc slots to see if the exiting process is queued. */
|
||||
@@ -245,26 +243,19 @@ int proc_nr; /* slot of process to clean up */
|
||||
|
||||
/* Check the table with IRQ hooks to see if hooks should be released. */
|
||||
for (i=0; i < NR_IRQ_HOOKS; i++) {
|
||||
if (irq_hooks[i].proc_nr == proc_nr)
|
||||
irq_hooks[i].proc_nr = NONE;
|
||||
if (irq_hooks[i].proc_nr == proc_nr(rc)) {
|
||||
rm_irq_handler(&irq_hooks[i]); /* remove interrupt handler */
|
||||
irq_hooks[i].proc_nr = NONE; /* mark hook as free */
|
||||
}
|
||||
}
|
||||
|
||||
#if TEMP_CODE
|
||||
/* Check if there are pending notifications. Release the buffers. */
|
||||
while (rc->p_ntf_q != NULL) {
|
||||
i = (int) (rc->p_ntf_q - ¬ify_buffer[0]);
|
||||
free_bit(i, notify_bitmap, NR_NOTIFY_BUFS);
|
||||
rc->p_ntf_q = rc->p_ntf_q->n_next;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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(rp)->s_flags & SYS_PROC) priv(rp)->s_proc_nr = NONE;
|
||||
if (priv(rc)->s_flags & SYS_PROC) priv(rc)->s_proc_nr = NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user