[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: patch: init's halt message
From: Paul Fox <pgf () brightstareng ! com>
Date: 2006-05-30 21:13:42
Message-ID: 5825.1149023622 () brightstareng ! com
[Download RAW message or body]
my apologies -- the patch in my previous message on this topic
was against 1.1.3, not against svn, and it doesn't quite apply
cleanly.
i'll do a proper commit in a day or two, to let people have time
to object.
i wrote:
> well, i wasn't planning on changing the long "please stand by"
> message one gets when rebooting, but if i do that, and combine
> all three shutdown paths, there's a net savings of 42 bytes (by my
> count). the patch is a little messy to read, but basically it
> combines reboot_signal() and halt_signal() into a new routine
> which maps the userlevel signal to the right console message and
> the right reboot() parameter.
>
> from a UI point of view, the message will now simply be one of:
> "Requesting system reboot."
> "Requesting system poweroff."
> "Requesting system halt."
>
> (bernhard -- your other message consolidation may still be valid. i
> haven't tried it.)
>
> paul
> =---------------------
> paul fox, pgf@brightstareng.com
>
> Index: init/init.c
> ===================================================================
> RCS file: /cvs/thirdparty/busybox-1.1.3/init/init.c,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 init.c
> --- init/init.c 30 May 2006 15:18:09 -0000 1.1.1.1
> +++ init/init.c 30 May 2006 19:21:46 -0000
> @@ -176,7 +176,7 @@
> /* Function prototypes */
> static void delete_init_action(struct init_action *a);
> static int waitfor(const struct init_action *a);
> -static void halt_signal(int sig);
> +static void shutdown_signal(int sig);
>
>
> static void loop_forever(void)
> @@ -732,7 +732,7 @@
> } else {
> message(LOG | CONSOLE, "Bummer, can't open %s", a->terminal);
> }
> - halt_signal(SIGUSR1);
> + shutdown_signal(SIGUSR1);
> }
>
> /* Make sure the terminal will act fairly normal for us */
> @@ -754,33 +754,30 @@
> }
> }
>
> -static void halt_signal(int sig ATTRIBUTE_UNUSED)
> +static void shutdown_signal(int sig)
> {
> - shutdown_system();
> - message(CONSOLE | LOG, "The system is halted.");
> - sync();
> + char *m;
> + int rb;
>
> - /* allow time for last message to reach serial console */
> - sleep(2);
> -
> - if (sig == SIGUSR2)
> - init_reboot(RB_POWER_OFF);
> - else
> - init_reboot(RB_HALT_SYSTEM);
> -
> - loop_forever();
> -}
> -
> -static void reboot_signal(int sig ATTRIBUTE_UNUSED)
> -{
> shutdown_system();
> - message(CONSOLE | LOG, "Please stand by while rebooting the system.");
> +
> + if (sig == SIGTERM) {
> + m = "reboot";
> + rb = RB_AUTOBOOT;
> + } else if (sig == SIGUSR2) {
> + m = "poweroff";
> + rb = RB_POWER_OFF;
> + } else {
> + m = "halt";
> + rb = RB_HALT_SYSTEM;
> + }
> + message(CONSOLE | LOG, "Requesting system %s.", m);
> sync();
>
> /* allow time for last message to reach serial console */
> sleep(2);
>
> - init_reboot(RB_AUTOBOOT);
> + init_reboot(rb);
>
> loop_forever();
> }
> @@ -1029,10 +1026,10 @@
> * clear all of these in run() */
> signal(SIGHUP, exec_signal);
> signal(SIGQUIT, exec_signal);
> - signal(SIGUSR1, halt_signal);
> - signal(SIGUSR2, halt_signal);
> + signal(SIGUSR1, shutdown_signal);
> + signal(SIGUSR2, shutdown_signal);
> signal(SIGINT, ctrlaltdel_signal);
> - signal(SIGTERM, reboot_signal);
> + signal(SIGTERM, shutdown_signal);
> signal(SIGCONT, cont_handler);
> signal(SIGSTOP, stop_handler);
> signal(SIGTSTP, stop_handler);
>
>
>
>
=---------------------
paul fox, pgf@brightstareng.com
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic