1 /* vi: set sw=4 ts=4: */
3 * Stuff shared between init, reboot, halt, and poweroff
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
7 * Licensed under GPL version 2, see file LICENSE in this tarball for details.
11 #include <sys/reboot.h>
12 #include <sys/syslog.h>
13 #include "init_shared.h"
15 const char * const init_sending_format = "Sending SIG%s to all processes.";
17 const char * const bb_shutdown_format = "\r%s\n";
18 int bb_shutdown_system(unsigned long magic)
20 int pri = LOG_KERN|LOG_NOTICE|LOG_FACMASK;
23 /* Don't kill ourself */
24 signal(SIGTERM,SIG_IGN);
25 signal(SIGHUP,SIG_IGN);
28 /* Allow Ctrl-Alt-Del to reboot system. */
30 #define RB_ENABLE_CAD 0x89abcdef
32 reboot(RB_ENABLE_CAD);
34 openlog(applet_name, 0, pri);
36 message = "\nThe system is going down NOW !!";
37 syslog(pri, "%s", message);
38 printf(bb_shutdown_format, message);
42 /* Send signals to every process _except_ pid 1 */
44 syslog(pri, init_sending_format, message);
45 printf(bb_shutdown_format, message);
52 syslog(pri, init_sending_format, message);
53 printf(bb_shutdown_format, message);