diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-02-26 12:38:01 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-02-26 12:38:01 +0000 |
commit | 31773b71e89f79cb5afda834ce15538a8818067d (patch) | |
tree | 009cd0ea5e3a6ef5c23accbf90573e7e784adc13 | |
parent | f09f4e015bffe6db5d7e63d47b23f22db4806736 (diff) | |
download | busybox-w32-31773b71e89f79cb5afda834ce15538a8818067d.tar.gz busybox-w32-31773b71e89f79cb5afda834ce15538a8818067d.tar.bz2 busybox-w32-31773b71e89f79cb5afda834ce15538a8818067d.zip |
runsv: another tiny optimization
function old new delta
startservice 297 288 -9
ctrl 435 426 -9
-rw-r--r-- | runit/runsv.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/runit/runsv.c b/runit/runsv.c index 4155b8f43..6d34dc133 100644 --- a/runit/runsv.c +++ b/runit/runsv.c | |||
@@ -304,15 +304,14 @@ static void stopservice(struct svdir *s) | |||
304 | static void startservice(struct svdir *s) | 304 | static void startservice(struct svdir *s) |
305 | { | 305 | { |
306 | int p; | 306 | int p; |
307 | char *run[2]; | 307 | const char *run; |
308 | 308 | ||
309 | if (s->state == S_FINISH) | 309 | if (s->state == S_FINISH) |
310 | run[0] = (char*)"./finish"; | 310 | run = "./finish"; |
311 | else { | 311 | else { |
312 | run[0] = (char*)"./run"; | 312 | run = "./run"; |
313 | custom(s, 'u'); | 313 | custom(s, 'u'); |
314 | } | 314 | } |
315 | run[1] = NULL; | ||
316 | 315 | ||
317 | if (s->pid != 0) | 316 | if (s->pid != 0) |
318 | stopservice(s); /* should never happen */ | 317 | stopservice(s); /* should never happen */ |
@@ -340,8 +339,8 @@ static void startservice(struct svdir *s) | |||
340 | , SIG_DFL);*/ | 339 | , SIG_DFL);*/ |
341 | sig_unblock(SIGCHLD); | 340 | sig_unblock(SIGCHLD); |
342 | sig_unblock(SIGTERM); | 341 | sig_unblock(SIGTERM); |
343 | execvp(*run, run); | 342 | execl(run, run, (char *) NULL); |
344 | fatal2_cannot(s->islog ? "start log/" : "start ", *run); | 343 | fatal2_cannot(s->islog ? "start log/" : "start ", run); |
345 | } | 344 | } |
346 | /* parent */ | 345 | /* parent */ |
347 | if (s->state != S_FINISH) { | 346 | if (s->state != S_FINISH) { |
@@ -395,8 +394,7 @@ static int ctrl(struct svdir *s, char c) | |||
395 | case 'c': /* sig cont */ | 394 | case 'c': /* sig cont */ |
396 | if (s->pid && !custom(s, c)) | 395 | if (s->pid && !custom(s, c)) |
397 | kill(s->pid, SIGCONT); | 396 | kill(s->pid, SIGCONT); |
398 | if (s->ctrl & C_PAUSE) | 397 | s->ctrl &= ~C_PAUSE; |
399 | s->ctrl &= ~C_PAUSE; | ||
400 | update_status(s); | 398 | update_status(s); |
401 | break; | 399 | break; |
402 | case 'o': /* once */ | 400 | case 'o': /* once */ |