Adjustments for Johns init stuff,

-Erik
This commit is contained in:
Eric Andersen 1999-12-09 22:39:55 +00:00
parent f95ca97d1b
commit 6805d5d69e
5 changed files with 15 additions and 8 deletions

3
halt.c
View File

@ -26,6 +26,7 @@
extern int
halt_main(int argc, char ** argv)
{
exit( kill(1, SIGUSR1));
/* don't assume init's pid == 1 */
exit( kill(findInitPid(), SIGUSR1));
}

View File

@ -26,6 +26,7 @@
extern int
halt_main(int argc, char ** argv)
{
exit( kill(1, SIGUSR1));
/* don't assume init's pid == 1 */
exit( kill(findInitPid(), SIGUSR1));
}

View File

@ -26,6 +26,6 @@
extern int
reboot_main(int argc, char ** argv)
{
/* don't assume init's pid == 1 */
exit( kill(findInitPid(), SIGUSR2));
/* don't assume init's pid == 1 */
exit( kill(findInitPid(), SIGUSR2));
}

View File

@ -26,6 +26,6 @@
extern int
reboot_main(int argc, char ** argv)
{
/* don't assume init's pid == 1 */
exit( kill(findInitPid(), SIGUSR2));
/* don't assume init's pid == 1 */
exit( kill(findInitPid(), SIGUSR2));
}

View File

@ -1068,7 +1068,12 @@ extern long getNum (const char *cp)
}
#endif
#if 1
#if defined BB_INIT || defined BB_HALT || defined BB_REBOOT
#if ! defined BB_FEATURE_USE_PROCFS
#error Sorry, I depend on the /proc filesystem right now.
#endif
/* findInitPid()
*
* This finds the pid of init (which is not always 1).
@ -1095,7 +1100,7 @@ findInitPid()
fgets(buffer, 256, status);
fclose(status);
if ( (strcmp(&buffer[6], "init\n") == 0)) {
if ( (strstr(buffer, "init\n") != NULL )) {
return init_pid;
}
}