diff options
author | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-04-15 13:21:34 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-04-15 13:24:13 +0200 |
commit | 2cb64e48fcd664067f4bd87e8f46fad694c3c979 (patch) | |
tree | ebec8a79b361a0f0b5eb05da1f52f56ee974b368 /initd/main.c | |
parent | 6e839a4ad544218317ceebd85e83ab5a8a8e21cc (diff) |
Move initd signal setup to platform specific file
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'initd/main.c')
-rw-r--r-- | initd/main.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/initd/main.c b/initd/main.c index 192a49a..05f9271 100644 --- a/initd/main.c +++ b/initd/main.c @@ -25,8 +25,6 @@ #include <errno.h> #include <poll.h> -#include <sys/signalfd.h> - #include "init.h" static service_list_t cfg; @@ -189,32 +187,20 @@ int main(void) { int ti_sock = -1, sfd, ret, count; struct pollfd pfd[2]; - sigset_t mask; if (getpid() != 1) { fputs("init does not have pid 1, terminating!\n", stderr); return EXIT_FAILURE; } - if (reboot(LINUX_REBOOT_CMD_CAD_OFF)) - perror("cannot disable CTRL+ALT+DEL"); - if (svcscan(SVCDIR, &cfg)) { fputs("Error reading service list from " SVCDIR "\n" "Trying to continue anyway\n", stderr); } - sigfillset(&mask); - if (sigprocmask(SIG_SETMASK, &mask, NULL) == -1) { - perror("sigprocmask"); - return EXIT_FAILURE; - } - - sfd = signalfd(-1, &mask, SFD_CLOEXEC); - if (sfd == -1) { - perror("signalfd"); - return EXIT_FAILURE; - } + sfd = sigsetup(); + if (sfd < 0) + return -1; memset(pfd, 0, sizeof(pfd)); pfd[0].fd = sfd; |