From b864c727c835359b4acbcbf05563da84c33380f0 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 4 Nov 2018 15:33:00 +0100 Subject: Remove unused telinit code Signed-off-by: David Oberhollenzer --- initd/init.h | 1 - initd/main.c | 59 ----------------------------------------------------------- 2 files changed, 60 deletions(-) (limited to 'initd') diff --git a/initd/init.h b/initd/init.h index 7d525a2..d0acc81 100644 --- a/initd/init.h +++ b/initd/init.h @@ -34,7 +34,6 @@ #include #include "service.h" -#include "telinit.h" #include "util.h" #define RUNSVCBIN SCRIPTDIR "/runsvc" 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(); } } -- cgit v1.2.3