patch: init's halt message

Bernhard Fischer rep.nop at aon.at
Tue May 30 18:12:29 UTC 2006


On Tue, May 30, 2006 at 07:13:58PM +0200, Bernhard Fischer wrote:
>On Tue, May 30, 2006 at 12:37:04PM -0400, Paul Fox wrote:
>>anyone object to changing init's final message?  the current
>>message says "The system is halted" when that is not actually
>>the case.  when the kernel actually does halt, or powerdown, it
>>will print its own message.  seems better if init only announces
>>what it's trying to do, rather than claiming to have done it.

Perhaps also do something like the attached (can't test it currently).
There are plenty of others like this..

   text    data     bss     dec     hex filename
   5379      32       8    5419    152b init/init.o.oorig
   5366      32       8    5406    151e init/init.o

-------------- next part --------------
Index: init/init_shared.h
===================================================================
--- init/init_shared.h	(revision 15237)
+++ init/init_shared.h	(working copy)
@@ -1,3 +1,4 @@
 extern int kill_init(int sig);
 extern int bb_shutdown_system(unsigned long magic);
+const char * const init_sending_format = "Sending %s to all processes.";
 
Index: init/init.c
===================================================================
--- init/init.c	(revision 15237)
+++ init/init.c	(working copy)
@@ -683,12 +683,12 @@ static void shutdown_system(void)
 	sync();
 
 	/* Send signals to every process _except_ pid 1 */
-	message(CONSOLE | LOG, "Sending SIGTERM to all processes.");
+	message(CONSOLE | LOG, init_sending_format, "SIGTERM");
 	kill(-1, SIGTERM);
 	sleep(1);
 	sync();
 
-	message(CONSOLE | LOG, "Sending SIGKILL to all processes.");
+	message(CONSOLE | LOG, init_sending_format, "SIGKILL");
 	kill(-1, SIGKILL);
 	sleep(1);
 
Index: init/init_shared.c
===================================================================
--- init/init_shared.c	(revision 15237)
+++ init/init_shared.c	(working copy)
@@ -44,16 +44,16 @@ int bb_shutdown_system(unsigned long mag
 	sync();
 
 	/* Send signals to every process _except_ pid 1 */
-	message = "Sending SIGTERM to all processes.";
-	syslog(pri, "%s", message);
+	message = "SIGTERM";
+	syslog(pri, init_sending_format, message);
 	printf(bb_shutdown_format, message);
 
 	kill(-1, SIGTERM);
 	sleep(1);
 	sync();
 
-	message = "Sending SIGKILL to all processes.";
-	syslog(pri, "%s", message);
+	message = "SIGKILL";
+	syslog(pri, init_sending_format, message);
 	printf(bb_shutdown_format, message);
 
 	kill(-1, SIGKILL);


More information about the busybox mailing list