Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/init In single-user, after taking a signal and having t...



details:   https://anonhg.NetBSD.org/src/rev/bc6b74a19463
branches:  trunk
changeset: 525707:bc6b74a19463
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Tue Apr 16 01:59:37 2002 +0000

description:
In single-user, after taking a signal and having the `shell' die with
SIGKILL, go into an infinite loop (like in the runcom SIGTERM case), on the
assumption that reboot(8) is in the middle of taking the system down.
This fixes `panic: init died' from sysinst.

diffstat:

 sbin/init/init.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (41 lines):

diff -r 5866cb368e05 -r bc6b74a19463 sbin/init/init.c
--- a/sbin/init/init.c  Mon Apr 15 21:08:41 2002 +0000
+++ b/sbin/init/init.c  Tue Apr 16 01:59:37 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.48 2002/02/03 12:55:26 lukem Exp $  */
+/*     $NetBSD: init.c,v 1.49 2002/04/16 01:59:37 mycroft Exp $        */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)init.c     8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: init.c,v 1.48 2002/02/03 12:55:26 lukem Exp $");
+__RCSID("$NetBSD: init.c,v 1.49 2002/04/16 01:59:37 mycroft Exp $");
 #endif
 #endif /* not lint */
 
@@ -639,14 +639,14 @@
        if (requested_transition)
                return (state_func_t)requested_transition;
 
-       if (!WIFEXITED(status)) {
-               if (WTERMSIG(status) == SIGKILL) { 
-                       /* 
-                        *  reboot(8) killed shell? 
-                        */
-                       warning("single user shell terminated.");
-                       (void)sleep(STALL_TIMEOUT);
-                       _exit(0);
+       if (WIFSIGNALED(status)) {
+               if (WTERMSIG(status) == SIGKILL) {
+                       /* executed /sbin/reboot; wait for the end quietly */
+                       sigset_t s;
+       
+                       (void)sigfillset(&s);
+                       for (;;)
+                               (void)sigsuspend(&s);
                } else {        
                        warning("single user shell terminated, restarting");
                        return (state_func_t) single_user;



Home | Main Index | Thread Index | Old Index