Fixed a bug in PM: sending of reply messages didn't check if destination
process is still alive. This caused a panic in some situations, e.g., when all processes are killed on a shutdown.
This commit is contained in:
parent
c2be104821
commit
07d582872f
2 changed files with 9 additions and 4 deletions
|
@ -37,7 +37,7 @@ PUBLIC void main()
|
||||||
{
|
{
|
||||||
/* Main routine of the process manager. */
|
/* Main routine of the process manager. */
|
||||||
|
|
||||||
int result, proc_nr;
|
int result, s, proc_nr;
|
||||||
struct mproc *rmp;
|
struct mproc *rmp;
|
||||||
|
|
||||||
pm_init(); /* initialize process manager tables */
|
pm_init(); /* initialize process manager tables */
|
||||||
|
@ -74,9 +74,12 @@ PUBLIC void main()
|
||||||
* the call just made above. The processes must not be swapped out.
|
* the call just made above. The processes must not be swapped out.
|
||||||
*/
|
*/
|
||||||
for (proc_nr=0, rmp=mproc; proc_nr < NR_PROCS; proc_nr++, rmp++) {
|
for (proc_nr=0, rmp=mproc; proc_nr < NR_PROCS; proc_nr++, rmp++) {
|
||||||
if ((rmp->mp_flags & (REPLY | ONSWAP)) == REPLY) {
|
if ((rmp->mp_flags & IN_USE) &&
|
||||||
if (send(proc_nr, &rmp->mp_reply) != OK)
|
(rmp->mp_flags & (REPLY | ONSWAP)) == REPLY) {
|
||||||
|
if ((s=send(proc_nr, &rmp->mp_reply)) != OK) {
|
||||||
|
printf("Warning, PM send failed: %d, ", s);
|
||||||
panic("PM can't reply to", proc_nr);
|
panic("PM can't reply to", proc_nr);
|
||||||
|
}
|
||||||
rmp->mp_flags &= ~REPLY;
|
rmp->mp_flags &= ~REPLY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,8 +71,10 @@ PUBLIC int do_reboot()
|
||||||
tell_fs(REBOOT,0,0,0); /* tell FS to prepare for shutdown */
|
tell_fs(REBOOT,0,0,0); /* tell FS to prepare for shutdown */
|
||||||
check_sig(-1, SIGKILL); /* kill all processes except init */
|
check_sig(-1, SIGKILL); /* kill all processes except init */
|
||||||
|
|
||||||
|
/* Ask the kernel to abort. All system services, including the PM, will
|
||||||
|
* get a HARD_STOP notification. Await the notification in the main loop.
|
||||||
|
*/
|
||||||
sys_abort(m_in.reboot_flag, PM_PROC_NR, monitor_code, m_in.reboot_size);
|
sys_abort(m_in.reboot_flag, PM_PROC_NR, monitor_code, m_in.reboot_size);
|
||||||
sys_exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=====================================================================*
|
/*=====================================================================*
|
||||||
|
|
Loading…
Reference in a new issue