diff options
-rw-r--r-- | sinit.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -25,13 +25,15 @@ typedef struct { void (*func)(void); } Sigmap; +static void sigpoweroff(void); static void sigreap(void); static void sigreboot(void); static void spawn(const Arg *); static Sigmap dispatchsig[] = { - { SIGCHLD, sigreap }, - { SIGINT, sigreboot }, + { SIGUSR1, sigpoweroff }, + { SIGCHLD, sigreap }, + { SIGINT, sigreboot }, }; static int sigfd = -1; @@ -85,6 +87,12 @@ main(void) } static void +sigpoweroff(void) +{ + spawn(&(Arg){ .v = rcpoweroffcmd }); +} + +static void sigreap(void) { while (waitpid(-1, NULL, WNOHANG) > 0) |