aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2025-05-19 08:34:32 +0100
committerRon Yorston <rmy@pobox.com>2025-05-19 08:34:32 +0100
commit64bf69893bd99c305d13a956389f216e7d15c682 (patch)
tree7fa7d449f0633c86c1248c0bb86363dd9f46da38 /init
parenta807cdfa95cf4af2f84e207ed15887cc3514cb43 (diff)
parent5f07327251c93184dfcfc8d978fc35705930ec53 (diff)
downloadbusybox-w32-merge.tar.gz
busybox-w32-merge.tar.bz2
busybox-w32-merge.zip
Merge branch 'busybox' into mergemerge
Diffstat (limited to '')
-rw-r--r--init/init.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/init/init.c b/init/init.c
index 2ee1e4cde..797e0a0eb 100644
--- a/init/init.c
+++ b/init/init.c
@@ -1198,17 +1198,29 @@ int init_main(int argc UNUSED_PARAM, char **argv)
1198 /* Wait for any child process(es) to exit */ 1198 /* Wait for any child process(es) to exit */
1199 while (1) { 1199 while (1) {
1200 pid_t wpid; 1200 pid_t wpid;
1201 int status;
1201 struct init_action *a; 1202 struct init_action *a;
1202 1203
1203 wpid = waitpid(-1, NULL, WNOHANG); 1204 wpid = waitpid(-1, &status, WNOHANG);
1204 if (wpid <= 0) 1205 if (wpid <= 0)
1205 break; 1206 break;
1206 1207
1207 a = mark_terminated(wpid); 1208 a = mark_terminated(wpid);
1208 if (a) { 1209 if (a) {
1209 message(L_LOG, "process '%s' (pid %u) exited. " 1210 const char *s = "killed, signal";
1211 int ex = WTERMSIG(status);
1212 /* "if (!WIFSIGNALED(status))" generates more code:
1213 * on linux, WIFEXITED(status) is "WTERMSIG(status) == 0"
1214 * and WTERMSIG(status) is known, so compiler optimizes.
1215 */
1216 if (WIFEXITED(status)) {
1217 s = "exited, exitcode";
1218 ex = WEXITSTATUS(status);
1219 }
1220 message(L_LOG, "process '%s' (pid %u) %s:%d. "
1210 "Scheduling for restart.", 1221 "Scheduling for restart.",
1211 a->command, (unsigned)wpid); 1222 a->command, (unsigned)wpid,
1223 s, ex);
1212 } 1224 }
1213 } 1225 }
1214 1226