]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
raw_syscalls: define __NR_pidfd_send_signal if missing 3303/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 17 Mar 2020 20:55:38 +0000 (21:55 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 17 Mar 2020 20:55:38 +0000 (21:55 +0100)
On all architectures we care about it's 424.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/commands.c
src/lxc/raw_syscalls.c
src/lxc/utils.c

index 204af14f3060e6ce70af45dd70bcdea1e2958f25..9c73bb53a2e35f43763728f7ee074998bf96b05f 100644 (file)
@@ -689,7 +689,7 @@ static int lxc_cmd_stop_callback(int fd, struct lxc_cmd_req *req,
                stopsignal = handler->conf->stopsignal;
        memset(&rsp, 0, sizeof(rsp));
 
-       if (handler-> pidfd >= 0)
+       if (handler->pidfd >= 0)
                rsp.ret = lxc_raw_pidfd_send_signal(handler->pidfd, stopsignal, NULL, 0);
        else
                rsp.ret = kill(handler->pid, stopsignal);
index bfa48c0348a2d04f68b628909f3b9ee5dcace767..d30b938633e8267f5412dff2526ed7c28f52c344 100644 (file)
@@ -123,13 +123,13 @@ pid_t lxc_raw_clone_cb(int (*fn)(void *), void *args, unsigned long flags,
        return pid;
 }
 
+/* For all the architectures we care about it's the same syscall number. */
+#ifndef __NR_pidfd_send_signal
+#define __NR_pidfd_send_signal 424
+#endif
+
 int lxc_raw_pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
                              unsigned int flags)
 {
-#ifdef __NR_pidfd_send_signal
        return syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags);
-#else
-       errno = ENOSYS;
-       return -1;
-#endif
 }
index a3b5f128f17c2b379eea0ed8e5b6d6c2f573675d..25ae794b0d9756c8ff646ebff6ddbe9407cbf225 100644 (file)
@@ -1833,5 +1833,9 @@ bool lxc_can_use_pidfd(int pidfd)
        if (ret < 0)
                return log_error_errno(false, errno, "Kernel does not support waiting on processes through pidfds");
 
+       ret = lxc_raw_pidfd_send_signal(pidfd, 0, NULL, 0);
+       if (ret)
+               return log_error_errno(false, errno, "Kernel does not support sending singals through pidfds");
+
        return log_trace(true, "Kernel supports pidfds");
 }