* Copyright (c) 1980, 1986 The Regents of the University of California.
* %sccs.include.redist.c%
"@(#) Copyright (c) 1980, 1986 The Regents of the University of California.\n\
static char sccsid
[] = "@(#)reboot.c 5.10 (Berkeley) %G%";
openlog("reboot", 0, LOG_AUTH
);
if (!strcmp(*argv
, "-q"))
else if (!strcmp(*argv
, "-n"))
else if (!strcmp(*argv
, "-l"))
"usage: reboot [ -n ][ -q ]\n");
if (user
== (char *)0 && (pw
= getpwuid(getuid())))
syslog(LOG_CRIT
, "rebooted by %s", user
);
signal(SIGHUP
, SIG_IGN
); /* for remote connections */
if (kill(1, SIGTSTP
) == -1) {
fprintf(stderr
, "reboot: can't idle init\n");
(void) kill(-1, SIGTERM
); /* one chance to catch it */
if (!qflag
) for (i
= 1; ; i
++) {
if (kill(-1, SIGKILL
) == -1) {
"CAUTION: some process(es) wouldn't die\n");
if (!qflag
&& (howto
& RB_NOSYNC
) == 0) {
logwtmp("~", "shutdown", "");
syscall(SYS_reboot
, howto
);
/* RRRIIINNNGGG RRRIIINNNGGG */
signal(SIGALRM
, dingdong
);