From 13aa3840cc94ce37ef1e63c093c0f71ac84e90fd Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 7 May 2020 22:04:42 +0200 Subject: Temporarily remove initsock handling code Signed-off-by: David Oberhollenzer --- initd/main.c | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) (limited to 'initd/main.c') diff --git a/initd/main.c b/initd/main.c index e59d809..5a4c37a 100644 --- a/initd/main.c +++ b/initd/main.c @@ -2,7 +2,6 @@ #include "init.h" static int sigfd = -1; -static int sockfd = -1; static void handle_signal(void) { @@ -33,46 +32,6 @@ static void handle_signal(void) case SIGHUP: break; case SIGUSR1: - if (sockfd >= 0) { - close(sockfd); - unlink(INIT_SOCK_PATH); - sockfd = -1; - } - sockfd = init_socket_create(); - break; - } -} - -static void handle_request(void) -{ - struct sockaddr_un addr; - init_request_t rq; - socklen_t addrlen; - ssize_t ret; -retry: - memset(&rq, 0, sizeof(rq)); - addrlen = sizeof(addr); - ret = recvfrom(sockfd, &rq, sizeof(rq), MSG_DONTWAIT | MSG_TRUNC, - (struct sockaddr *)&addr, &addrlen); - - if (ret < 0 && errno == EINTR) - goto retry; - - if ((size_t)ret < sizeof(rq)) - return; - - switch (rq.rq) { - case EIR_STATUS: - supervisor_answer_status_request(sockfd, &addr, addrlen, - rq.arg.status.filter); - break; - case EIR_START: - rq.arg.startstop.id = be32toh(rq.arg.startstop.id); - supervisor_start(rq.arg.startstop.id); - break; - case EIR_STOP: - rq.arg.startstop.id = be32toh(rq.arg.startstop.id); - supervisor_stop(rq.arg.startstop.id); break; } } @@ -81,8 +40,6 @@ void target_completed(int target) { switch (target) { case TGT_BOOT: - if (sockfd < 0) - sockfd = init_socket_create(); break; case TGT_SHUTDOWN: for (;;) @@ -145,12 +102,6 @@ int main(void) pfd[count].events = POLLIN; ++count; - if (sockfd >= 0) { - pfd[count].fd = sockfd; - pfd[count].events = POLLIN; - ++count; - } - ret = poll(pfd, count, -1); if (ret <= 0) continue; @@ -159,8 +110,6 @@ int main(void) if (pfd[i].revents & POLLIN) { if (pfd[i].fd == sigfd) handle_signal(); - if (pfd[i].fd == sockfd) - handle_request(); } } } -- cgit v1.2.3