aboutsummaryrefslogtreecommitdiff
path: root/initd/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'initd/main.c')
-rw-r--r--initd/main.c51
1 files changed, 0 insertions, 51 deletions
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();
}
}
}