projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add platform tweaks
[oweals/busybox.git]
/
runit
/
runsv.c
diff --git
a/runit/runsv.c
b/runit/runsv.c
index bd0f3dcc2583bd20534e0163af543a81b77e9bd5..6d34dc133005de7a4b6022327d5d6deb6f6ad3fc 100644
(file)
--- a/
runit/runsv.c
+++ b/
runit/runsv.c
@@
-247,11
+247,10
@@
static void update_status(struct svdir *s)
static unsigned custom(struct svdir *s, char c)
{
static unsigned custom(struct svdir *s, char c)
{
-
in
t pid;
+
pid_
t pid;
int w;
char a[10];
struct stat st;
int w;
char a[10];
struct stat st;
- char *prog[2];
if (s->islog) return 0;
strcpy(a, "control/?");
if (s->islog) return 0;
strcpy(a, "control/?");
@@
-267,13
+266,11
@@
static unsigned custom(struct svdir *s, char c)
/* child */
if (haslog && dup2(logpipe.wr, 1) == -1)
warn_cannot("setup stdout for control/?");
/* child */
if (haslog && dup2(logpipe.wr, 1) == -1)
warn_cannot("setup stdout for control/?");
- prog[0] = a;
- prog[1] = NULL;
- execv(a, prog);
+ execl(a, a, (char *) NULL);
fatal_cannot("run control/?");
}
/* parent */
fatal_cannot("run control/?");
}
/* parent */
-
while
(safe_waitpid(pid, &w, 0) == -1) {
+
if
(safe_waitpid(pid, &w, 0) == -1) {
warn_cannot("wait for child control/?");
return 0;
}
warn_cannot("wait for child control/?");
return 0;
}
@@
-307,15
+304,14
@@
static void stopservice(struct svdir *s)
static void startservice(struct svdir *s)
{
int p;
static void startservice(struct svdir *s)
{
int p;
- c
har *run[2]
;
+ c
onst char *run
;
if (s->state == S_FINISH)
if (s->state == S_FINISH)
- run
[0] = (char*)
"./finish";
+ run
=
"./finish";
else {
else {
- run
[0] = (char*)
"./run";
+ run
=
"./run";
custom(s, 'u');
}
custom(s, 'u');
}
- run[1] = NULL;
if (s->pid != 0)
stopservice(s); /* should never happen */
if (s->pid != 0)
stopservice(s); /* should never happen */
@@
-336,14
+332,15
@@
static void startservice(struct svdir *s)
xdup2(logpipe.wr, 1);
}
}
xdup2(logpipe.wr, 1);
}
}
- bb_signals(0
+ /* Non-ignored signals revert to SIG_DFL on exec anyway */
+ /*bb_signals(0
+ (1 << SIGCHLD)
+ (1 << SIGTERM)
+ (1 << SIGCHLD)
+ (1 << SIGTERM)
- , SIG_DFL);
+ , SIG_DFL);
*/
sig_unblock(SIGCHLD);
sig_unblock(SIGTERM);
sig_unblock(SIGCHLD);
sig_unblock(SIGTERM);
- exec
vp(*run, run
);
- fatal2_cannot(s->islog ? "start log/" : "start ",
*
run);
+ exec
l(run, run, (char *) NULL
);
+ fatal2_cannot(s->islog ? "start log/" : "start ", run);
}
/* parent */
if (s->state != S_FINISH) {
}
/* parent */
if (s->state != S_FINISH) {
@@
-397,8
+394,7
@@
static int ctrl(struct svdir *s, char c)
case 'c': /* sig cont */
if (s->pid && !custom(s, c))
kill(s->pid, SIGCONT);
case 'c': /* sig cont */
if (s->pid && !custom(s, c))
kill(s->pid, SIGCONT);
- if (s->ctrl & C_PAUSE)
- s->ctrl &= ~C_PAUSE;
+ s->ctrl &= ~C_PAUSE;
update_status(s);
break;
case 'o': /* once */
update_status(s);
break;
case 'o': /* once */
@@
-454,9
+450,9
@@
int runsv_main(int argc UNUSED_PARAM, char **argv)
ndelay_on(selfpipe.wr);
sig_block(SIGCHLD);
ndelay_on(selfpipe.wr);
sig_block(SIGCHLD);
- bb_signals_recursive(1 << SIGCHLD, s_child);
+ bb_signals_recursive
_norestart
(1 << SIGCHLD, s_child);
sig_block(SIGTERM);
sig_block(SIGTERM);
- bb_signals_recursive(1 << SIGTERM, s_term);
+ bb_signals_recursive
_norestart
(1 << SIGTERM, s_term);
xchdir(dir);
/* bss: svd[0].pid = 0; */
xchdir(dir);
/* bss: svd[0].pid = 0; */
@@
-584,7
+580,7
@@
int runsv_main(int argc UNUSED_PARAM, char **argv)
continue;
for (;;) {
continue;
for (;;) {
-
in
t child;
+
pid_
t child;
int wstat;
child = wait_any_nohang(&wstat);
int wstat;
child = wait_any_nohang(&wstat);