Look for either "init" or "linuxrc" processes
This commit is contained in:
parent
f0a4ac8216
commit
371ca19f53
7
halt.c
7
halt.c
@ -29,8 +29,11 @@ extern int halt_main(int argc, char **argv)
|
|||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
pid_t *pid = find_pid_by_name("init");
|
pid_t *pid = find_pid_by_name("init");
|
||||||
if (!pid || *pid<=0)
|
if (!pid || *pid<=0) {
|
||||||
error_msg_and_die("no process killed");
|
pid_t *pid = find_pid_by_name("linuxrc");
|
||||||
|
if (!pid || *pid<=0)
|
||||||
|
error_msg_and_die("no process killed");
|
||||||
|
}
|
||||||
return(kill(*pid, SIGUSR1));
|
return(kill(*pid, SIGUSR1));
|
||||||
#else
|
#else
|
||||||
return(kill(1, SIGUSR1));
|
return(kill(1, SIGUSR1));
|
||||||
|
@ -29,8 +29,11 @@ extern int halt_main(int argc, char **argv)
|
|||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
pid_t *pid = find_pid_by_name("init");
|
pid_t *pid = find_pid_by_name("init");
|
||||||
if (!pid || *pid<=0)
|
if (!pid || *pid<=0) {
|
||||||
error_msg_and_die("no process killed");
|
pid_t *pid = find_pid_by_name("linuxrc");
|
||||||
|
if (!pid || *pid<=0)
|
||||||
|
error_msg_and_die("no process killed");
|
||||||
|
}
|
||||||
return(kill(*pid, SIGUSR1));
|
return(kill(*pid, SIGUSR1));
|
||||||
#else
|
#else
|
||||||
return(kill(1, SIGUSR1));
|
return(kill(1, SIGUSR1));
|
||||||
|
@ -29,8 +29,11 @@ extern int poweroff_main(int argc, char **argv)
|
|||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
pid_t *pid = find_pid_by_name("init");
|
pid_t *pid = find_pid_by_name("init");
|
||||||
if (!pid || *pid<=0)
|
if (!pid || *pid<=0) {
|
||||||
error_msg_and_die("no process killed");
|
pid_t *pid = find_pid_by_name("linuxrc");
|
||||||
|
if (!pid || *pid<=0)
|
||||||
|
error_msg_and_die("no process killed");
|
||||||
|
}
|
||||||
return(kill(*pid, SIGUSR2));
|
return(kill(*pid, SIGUSR2));
|
||||||
#else
|
#else
|
||||||
return(kill(1, SIGUSR2));
|
return(kill(1, SIGUSR2));
|
||||||
|
@ -29,8 +29,11 @@ extern int reboot_main(int argc, char **argv)
|
|||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
pid_t *pid = find_pid_by_name("init");
|
pid_t *pid = find_pid_by_name("init");
|
||||||
if (!pid || *pid<=0)
|
if (!pid || *pid<=0) {
|
||||||
error_msg_and_die("no process killed");
|
pid_t *pid = find_pid_by_name("linuxrc");
|
||||||
|
if (!pid || *pid<=0)
|
||||||
|
error_msg_and_die("no process killed");
|
||||||
|
}
|
||||||
return(kill(*pid, SIGTERM));
|
return(kill(*pid, SIGTERM));
|
||||||
#else
|
#else
|
||||||
return(kill(1, SIGTERM));
|
return(kill(1, SIGTERM));
|
||||||
|
@ -29,8 +29,11 @@ extern int poweroff_main(int argc, char **argv)
|
|||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
pid_t *pid = find_pid_by_name("init");
|
pid_t *pid = find_pid_by_name("init");
|
||||||
if (!pid || *pid<=0)
|
if (!pid || *pid<=0) {
|
||||||
error_msg_and_die("no process killed");
|
pid_t *pid = find_pid_by_name("linuxrc");
|
||||||
|
if (!pid || *pid<=0)
|
||||||
|
error_msg_and_die("no process killed");
|
||||||
|
}
|
||||||
return(kill(*pid, SIGUSR2));
|
return(kill(*pid, SIGUSR2));
|
||||||
#else
|
#else
|
||||||
return(kill(1, SIGUSR2));
|
return(kill(1, SIGUSR2));
|
||||||
|
7
reboot.c
7
reboot.c
@ -29,8 +29,11 @@ extern int reboot_main(int argc, char **argv)
|
|||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
pid_t *pid = find_pid_by_name("init");
|
pid_t *pid = find_pid_by_name("init");
|
||||||
if (!pid || *pid<=0)
|
if (!pid || *pid<=0) {
|
||||||
error_msg_and_die("no process killed");
|
pid_t *pid = find_pid_by_name("linuxrc");
|
||||||
|
if (!pid || *pid<=0)
|
||||||
|
error_msg_and_die("no process killed");
|
||||||
|
}
|
||||||
return(kill(*pid, SIGTERM));
|
return(kill(*pid, SIGTERM));
|
||||||
#else
|
#else
|
||||||
return(kill(1, SIGTERM));
|
return(kill(1, SIGTERM));
|
||||||
|
Loading…
Reference in New Issue
Block a user