c0718054e9
- 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);
42 lines
1.4 KiB
C
42 lines
1.4 KiB
C
/* The system call implemented in this file:
|
|
* m_type: SYS_EXIT
|
|
*
|
|
* The parameters for this system call are:
|
|
* m1_i1: PR_PROC_NR (slot number of exiting process)
|
|
*/
|
|
|
|
#include "../system.h"
|
|
|
|
#if USE_EXIT
|
|
|
|
/*===========================================================================*
|
|
* do_exit *
|
|
*===========================================================================*/
|
|
PUBLIC int do_exit(m_ptr)
|
|
message *m_ptr; /* pointer to request message */
|
|
{
|
|
/* Handle sys_exit. A user process has exited or a system process requests
|
|
* to exit. Only the PM can request other process slots to be cleared.
|
|
* The routine to clean up a process table slot cancels outstanding timers,
|
|
* possibly removes the process from the message queues, and resets certain
|
|
* process table fields to the default values.
|
|
*/
|
|
int exit_proc_nr;
|
|
|
|
/* Determine what process exited. User processes are handled here. */
|
|
if (PM_PROC_NR == m_ptr->m_source) {
|
|
exit_proc_nr = m_ptr->PR_PROC_NR; /* get exiting process */
|
|
if (exit_proc_nr != SELF) { /* PM tries to exit self */
|
|
if (! isokprocn(exit_proc_nr)) return(EINVAL);
|
|
clear_proc(proc_addr(exit_proc_nr)); /* exit a user process */
|
|
return(OK); /* report back to PM */
|
|
}
|
|
}
|
|
|
|
/* The PM or some other system process requested to be exited. */
|
|
clear_proc(proc_addr(m_ptr->m_source));
|
|
return(EDONTREPLY);
|
|
}
|
|
#endif /* USE_EXIT */
|
|
|
|
|