From 74f1fb86c974ad805614f8d96388c2df7911eb55 Mon Sep 17 00:00:00 2001 From: sin Date: Sat, 8 Feb 2014 12:36:34 +0000 Subject: Remove Arg - it is a leftover from when we had the FIFO code --- config.def.h | 6 +++--- sinit.c | 19 +++++++------------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/config.def.h b/config.def.h index 75b2329..c689987 100644 --- a/config.def.h +++ b/config.def.h @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -static const char *rcinitcmd[] = { "/bin/rc.init", NULL }; -static const char *rcrebootcmd[] = { "/bin/rc.shutdown", "reboot", NULL }; -static const char *rcpoweroffcmd[] = { "/bin/rc.shutdown", "poweroff", NULL }; +static char *const rcinitcmd[] = { "/bin/rc.init", NULL }; +static char *const rcrebootcmd[] = { "/bin/rc.shutdown", "reboot", NULL }; +static char *const rcpoweroffcmd[] = { "/bin/rc.shutdown", "poweroff", NULL }; diff --git a/sinit.c b/sinit.c index c18146b..4939bc5 100644 --- a/sinit.c +++ b/sinit.c @@ -14,10 +14,6 @@ #include #include "util.h" -typedef union { - const void *v; -} Arg; - typedef struct { int sig; void (*func)(void); @@ -26,7 +22,7 @@ typedef struct { static void sigpoweroff(void); static void sigreap(void); static void sigreboot(void); -static void spawn(const Arg *); +static void spawn(char *const []); static Sigmap dispatchsig[] = { { SIGUSR1, sigpoweroff }, @@ -65,7 +61,7 @@ main(void) if (sigfd < 0) eprintf("sinit: signalfd:"); - spawn(&(Arg){ .v = rcinitcmd }); + spawn(rcinitcmd); while (1) { FD_ZERO(&rfds); @@ -93,7 +89,7 @@ main(void) static void sigpoweroff(void) { - spawn(&(Arg){ .v = rcpoweroffcmd }); + spawn(rcpoweroffcmd); } static void @@ -106,14 +102,13 @@ sigreap(void) static void sigreboot(void) { - spawn(&(Arg){ .v = rcrebootcmd }); + spawn(rcrebootcmd); } static void -spawn(const Arg *arg) +spawn(char *const argv[]) { pid_t pid; - char *const *p = arg->v; pid = fork(); if (pid < 0) { @@ -121,8 +116,8 @@ spawn(const Arg *arg) } else if (pid == 0) { setsid(); setpgid(0, 0); - execvp(*p, p); - weprintf("sinit: execvp %s:", *p); + execvp(argv[0], argv); + weprintf("sinit: execvp %s:", argv[0]); _exit(errno == ENOENT ? 127 : 126); } } -- cgit v1.2.3-70-g09d2