diff options
author | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-11-04 15:33:00 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-11-04 15:33:00 +0100 |
commit | b864c727c835359b4acbcbf05563da84c33380f0 (patch) | |
tree | d78ebdefd82cbdfbda0eb53e6dbe56fd7f6f0d45 /initd/main.c | |
parent | c0e8c7e245c09598478302155b37a15f3370571f (diff) |
Remove unused telinit code
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'initd/main.c')
-rw-r--r-- | initd/main.c | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/initd/main.c b/initd/main.c index b50c09c..64dd7ac 100644 --- a/initd/main.c +++ b/initd/main.c @@ -17,7 +17,6 @@ */ #include "init.h" -static int ti_sock = -1; static int sigfd = -1; static void handle_signal(void) @@ -49,59 +48,10 @@ static void handle_signal(void) } } -static int read_msg(int fd, ti_msg_t *msg) -{ - ssize_t ret; -retry: - ret = read(fd, msg, sizeof(*msg)); - - if (ret < 0) { - if (errno == EINTR) - goto retry; - perror("read on telinit socket"); - return -1; - } - - if ((size_t)ret < sizeof(*msg)) { - fputs("short read on telinit socket", stderr); - return -1; - } - - return 0; -} - -static void handle_tellinit(void) -{ - ti_msg_t msg; - int fd; - - fd = accept(ti_sock, NULL, NULL); - if (fd == -1) - return; - - if (read_msg(fd, &msg)) { - close(fd); - return; - } - - switch (msg.type) { - case TI_SHUTDOWN: - supervisor_set_target(TGT_SHUTDOWN); - break; - case TI_REBOOT: - supervisor_set_target(TGT_REBOOT); - break; - } - - close(fd); -} - void target_completed(int target) { switch (target) { case TGT_BOOT: - if (ti_sock == -1) - ti_sock = mksock(INITSOCK, SOCK_FLAG_ROOT_ONLY); break; case TGT_SHUTDOWN: for (;;) @@ -139,20 +89,11 @@ int main(void) pfd[0].events = POLLIN; count = 1; - if (ti_sock != -1) { - pfd[1].fd = ti_sock; - pfd[1].events = POLLIN; - count = 2; - } - ret = poll(pfd, count, -1); if (ret > 0) { if (pfd[0].revents & POLLIN) handle_signal(); - - if (ti_sock != -1 && pfd[1].revents & POLLIN) - handle_tellinit(); } } |