commit 74f1fb86c974ad805614f8d96388c2df7911eb55
parent 948ceeb6750119251fa81baa662d109eb1206247
Author: sin <sin@2f30.org>
Date: Sat, 8 Feb 2014 12:36:34 +0000
Remove Arg - it is a leftover from when we had the FIFO code
Diffstat:
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git 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
@@ -14,10 +14,6 @@
#include <unistd.h>
#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);
}
}