Introduction
Introduction Statistics Contact Development Disclaimer Help
Poweroff on SIGUSR1 - sinit - suckless init
git clone git://git.suckless.org/sinit
Log
Files
Refs
README
LICENSE
---
commit 76b2240e1587129d4baefaffb738332440e20290
parent b8cb53193c0d235cec99d70bb63838f27c3c5fda
Author: sin <[email protected]>
Date: Fri, 7 Feb 2014 16:18:02 +0000
Poweroff on SIGUSR1
Diffstat:
M sinit.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/sinit.c b/sinit.c
@@ -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)
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.