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 GPLv2 or later, see file LICENSE in this tarball for details.
14 #include <sys/reboot.h>
15 #include <sys/syslog.h>
17 #include "init_shared.h"
20 const char * const bb_shutdown_format = "\r%s\n";
21 extern int bb_shutdown_system(unsigned long magic)
23 int pri = LOG_KERN|LOG_NOTICE|LOG_FACMASK;
26 /* Don't kill ourself */
27 signal(SIGTERM,SIG_IGN);
28 signal(SIGHUP,SIG_IGN);
31 /* Allow Ctrl-Alt-Del to reboot system. */
33 #define RB_ENABLE_CAD 0x89abcdef
35 reboot(RB_ENABLE_CAD);
37 openlog(bb_applet_name, 0, pri);
39 message = "\nThe system is going down NOW !!";
40 syslog(pri, "%s", message);
41 printf(bb_shutdown_format, message);
45 /* Send signals to every process _except_ pid 1 */
46 message = "Sending SIGTERM to all processes.";
47 syslog(pri, "%s", message);
48 printf(bb_shutdown_format, message);
54 message = "Sending SIGKILL to all processes.";
55 syslog(pri, "%s", message);
56 printf(bb_shutdown_format, message);