summaryrefslogtreecommitdiff
path: root/init/init_shared.c
diff options
context:
space:
mode:
authorEric Andersen2003-07-22 17:14:10 +0000
committerEric Andersen2003-07-22 17:14:10 +0000
commit20c9f1e5e7290c7d22bdf4217e66b9d75e9e73df (patch)
tree0792d9bc4880082abe6eafce02d55f086ca4a500 /init/init_shared.c
parent4c6c23678172a4d92e1906fcda3229558eb31dd6 (diff)
downloadbusybox-20c9f1e5e7290c7d22bdf4217e66b9d75e9e73df.zip
busybox-20c9f1e5e7290c7d22bdf4217e66b9d75e9e73df.tar.gz
Several simplifications and indenting changes, per
last_patch97 from vodz
Diffstat (limited to 'init/init_shared.c')
-rw-r--r--init/init_shared.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/init/init_shared.c b/init/init_shared.c
index 81e1ea0..339add1 100644
--- a/init/init_shared.c
+++ b/init/init_shared.c
@@ -47,52 +47,51 @@ extern int kill_init(int sig)
}
#ifndef CONFIG_INIT
-#define LOG 0x1
-#define CONSOLE 0x2
+const char * const bb_shutdown_format = "\r%s\n";
extern int bb_shutdown_system(unsigned long magic)
{
int pri = LOG_KERN|LOG_NOTICE|LOG_FACMASK;
- char *message;
+ const char *message;
- /* Don't kill ourself */
- signal(SIGTERM,SIG_IGN);
- signal(SIGHUP,SIG_IGN);
- setpgrp();
+ /* Don't kill ourself */
+ signal(SIGTERM,SIG_IGN);
+ signal(SIGHUP,SIG_IGN);
+ setpgrp();
- /* Allow Ctrl-Alt-Del to reboot system. */
+ /* Allow Ctrl-Alt-Del to reboot system. */
#ifndef RB_ENABLE_CAD
#define RB_ENABLE_CAD 0x89abcdef
#endif
- reboot(RB_ENABLE_CAD);
+ reboot(RB_ENABLE_CAD);
- openlog("shutdown", 0, pri);
+ openlog(bb_applet_name, 0, pri);
- message = "\n\rThe system is going down NOW !!\n";
+ message = "\nThe system is going down NOW !!";
syslog(pri, "%s", message);
- fprintf(stdout, "%s", message);
+ printf(bb_shutdown_format, message);
- sync();
+ sync();
- /* Send signals to every process _except_ pid 1 */
- message = "\rSending SIGTERM to all processes.\n";
+ /* Send signals to every process _except_ pid 1 */
+ message = "Sending SIGTERM to all processes.";
syslog(pri, "%s", message);
- fprintf(stdout, "%s", message);
+ printf(bb_shutdown_format, message);
- kill(-1, SIGTERM);
- sleep(1);
- sync();
+ kill(-1, SIGTERM);
+ sleep(1);
+ sync();
- message = "\rSending SIGKILL to all processes.\n";
+ message = "Sending SIGKILL to all processes.";
syslog(pri, "%s", message);
- fprintf(stdout, "%s", message);
+ printf(bb_shutdown_format, message);
- kill(-1, SIGKILL);
- sleep(1);
+ kill(-1, SIGKILL);
+ sleep(1);
- sync();
+ sync();
- reboot(magic);
- return 0; /* Shrug */
+ reboot(magic);
+ return 0; /* Shrug */
}
#endif