SCCS-vsn: old/init/init.c 4.3
SCCS-vsn: sbin/init/init.c 4.3
+static char *sccsid = "@(#)init.c 4.3 (Berkeley) %G%";
#include <signal.h>
#include <sys/types.h>
#include <utmp.h>
#include <signal.h>
#include <sys/types.h>
#include <utmp.h>
int fi;
int mergflag;
char tty[20];
int fi;
int mergflag;
char tty[20];
+jmp_buf sjbuf, shutpass;
int reset();
char *strcpy(), *strcat();
int reset();
char *strcpy(), *strcat();
for(EVER) {
oldhowto = howto;
howto = RB_SINGLE;
for(EVER) {
oldhowto = howto;
howto = RB_SINGLE;
+ if (setjmp(shutpass) == 0)
+ shutdown();
if (oldhowto & RB_SINGLE)
single();
if (runcom(oldhowto) == 0)
if (oldhowto & RB_SINGLE)
single();
if (runcom(oldhowto) == 0)
term(p);
p->line[0] = 0;
}
term(p);
p->line[0] = 0;
}
- signal(SIGALRM, reset);
- alarm(60);
+ signal(SIGALRM, shutreset);
+ alarm(30);
for(i=0; i<5; i++)
kill(-1, SIGKILL);
while(wait((int *)0) != -1)
;
alarm(0);
for(i=0; i<5; i++)
kill(-1, SIGKILL);
while(wait((int *)0) != -1)
;
alarm(0);
+ shutend();
+}
+
+char shutfailm[] = "WARNING: Something is hung (wont die); ps axl advised\n";
+
+shutreset()
+{
+ int status;
+
+ if (fork() == 0) {
+ int ct = open(ctty, 1);
+ write(ct, shutfailm, sizeof (shutfailm));
+ sleep(5);
+ exit(1);
+ }
+ sleep(5);
+ shutend();
+ longjmp(shutpass, 1);
+}
+
+shutend()
+{
+ register i;
+
signal(SIGALRM, SIG_DFL);
for(i=0; i<10; i++)
close(i);
signal(SIGALRM, SIG_DFL);
for(i=0; i<10; i++)
close(i);
+static char *sccsid = "@(#)init.c 4.3 (Berkeley) %G%";
#include <signal.h>
#include <sys/types.h>
#include <utmp.h>
#include <signal.h>
#include <sys/types.h>
#include <utmp.h>
int fi;
int mergflag;
char tty[20];
int fi;
int mergflag;
char tty[20];
+jmp_buf sjbuf, shutpass;
int reset();
char *strcpy(), *strcat();
int reset();
char *strcpy(), *strcat();
for(EVER) {
oldhowto = howto;
howto = RB_SINGLE;
for(EVER) {
oldhowto = howto;
howto = RB_SINGLE;
+ if (setjmp(shutpass) == 0)
+ shutdown();
if (oldhowto & RB_SINGLE)
single();
if (runcom(oldhowto) == 0)
if (oldhowto & RB_SINGLE)
single();
if (runcom(oldhowto) == 0)
term(p);
p->line[0] = 0;
}
term(p);
p->line[0] = 0;
}
- signal(SIGALRM, reset);
- alarm(60);
+ signal(SIGALRM, shutreset);
+ alarm(30);
for(i=0; i<5; i++)
kill(-1, SIGKILL);
while(wait((int *)0) != -1)
;
alarm(0);
for(i=0; i<5; i++)
kill(-1, SIGKILL);
while(wait((int *)0) != -1)
;
alarm(0);
+ shutend();
+}
+
+char shutfailm[] = "WARNING: Something is hung (wont die); ps axl advised\n";
+
+shutreset()
+{
+ int status;
+
+ if (fork() == 0) {
+ int ct = open(ctty, 1);
+ write(ct, shutfailm, sizeof (shutfailm));
+ sleep(5);
+ exit(1);
+ }
+ sleep(5);
+ shutend();
+ longjmp(shutpass, 1);
+}
+
+shutend()
+{
+ register i;
+
signal(SIGALRM, SIG_DFL);
for(i=0; i<10; i++)
close(i);
signal(SIGALRM, SIG_DFL);
for(i=0; i<10; i++)
close(i);