From: Michael Tremer Date: Sun, 5 Nov 2023 17:36:37 +0000 (+0000) Subject: jail: Remove signalfd stuff X-Git-Tag: 0.9.30~1308 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=86f76d96cbae86eae2d67c4fab0ffbdfb729533d;p=pakfire.git jail: Remove signalfd stuff I don't think that we need this. Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/jail.c b/src/libpakfire/jail.c index dd24b7449..c7e314afe 100644 --- a/src/libpakfire/jail.c +++ b/src/libpakfire/jail.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -530,34 +529,6 @@ ERROR: return -1; } -// Signals - -#if 0 -static int pakfire_jail_handle_signals(struct pakfire_jail* jail) { - sigset_t mask; - int r; - - sigemptyset(&mask); - sigaddset(&mask, SIGINT); - - // Block signals - r = sigprocmask(SIG_BLOCK, &mask, NULL); - if (r < 0) { - ERROR(jail->pakfire, "Failed to block signals: %m\n"); - return r; - } - - // Create a file descriptor - r = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); - if (r < 0) { - ERROR(jail->pakfire, "Failed to create signalfd: %m\n"); - return r; - } - - return r; -} -#endif - /* This function replaces any logging in the child process. @@ -921,11 +892,6 @@ static int pakfire_jail_wait(struct pakfire_jail* jail, struct pakfire_jail_exec const int log_DEBUG = pakfire_jail_get_pipe_to_read(jail, &ctx->pipes.log_DEBUG); #endif /* ENABLE_DEBUG */ -#if 0 - // Signals - const int signalfd = pakfire_jail_handle_signals(jail); -#endif - // Make a list of all file descriptors we are interested in const struct pakfire_wait_fds { const int fd; @@ -944,11 +910,6 @@ static int pakfire_jail_wait(struct pakfire_jail* jail, struct pakfire_jail_exec // Child Processes { ctx->pidfd1, EPOLLIN }, -#if 0 - // Signals - { signafd, EPOLLIN }, -#endif - // Log Pipes { log_INFO, EPOLLIN }, { log_ERROR, EPOLLIN }, @@ -1067,39 +1028,6 @@ static int pakfire_jail_wait(struct pakfire_jail* jail, struct pakfire_jail_exec // There is nothing else to do continue; -#if 0 - // Handle signals - } else if (fd == signalfd) { - // Read the signal - r = read(signalfd, &siginfo, sizeof(siginfo)); - if (r < 1) { - ERROR(jail->pakfire, "Could not read signal: %m\n"); - goto ERROR; - } - - DEBUG(jail->pakfire, "Received signal %u\n", siginfo.ssi_signo); - - // Handle signals - switch (siginfo.ssi_signo) { - // Pass SIGINT down to the child process - case SIGINT: - r = pidfd_send_signal(pidfd, siginfo.ssi_signo, NULL, 0); - if (r) { - ERROR(jail->pakfire, "Could not send signal to process: %m\n"); - goto ERROR; - } - break; - - default: - ERROR(jail->pakfire, "Received unhandled signal %u\n", - siginfo.ssi_signo); - break; - } - - // Don't fall through to log processing - continue; -#endif - // Handle socket messages } else if (fd == socket_recv) { // Receive the FD of the second child process @@ -1219,10 +1147,6 @@ ERROR: close(epollfd); if (timerfd >= 0) close(timerfd); -#if 0 - if (signalfd >= 0) - close(signalfd); -#endif return r; }