start: handle kernel header and kernel incompatability

We might e.g. be compiled in a container with old kernel headers. In this scenario CLONE_PIDFD will work but pidfd_send_signal() might not be detected because __NR_pidfd_send_signal is not defined because the kernel headers don't match the kernel version. This explains and fixes test-suite hangs on Jenkins I've recently debugged. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent b4b6291c
...@@ -1076,11 +1076,13 @@ void lxc_abort(const char *name, struct lxc_handler *handler) ...@@ -1076,11 +1076,13 @@ void lxc_abort(const char *name, struct lxc_handler *handler)
lxc_set_state(name, handler, ABORTING); lxc_set_state(name, handler, ABORTING);
if (handler->pidfd >= 0) if (handler->pidfd >= 0) {
ret = lxc_raw_pidfd_send_signal(handler->pidfd, SIGKILL, NULL, 0); ret = lxc_raw_pidfd_send_signal(handler->pidfd, SIGKILL, NULL, 0);
else if (handler->pid > 0) if (ret)
ret = kill(handler->pid, SIGKILL); SYSWARN("Failed to send SIGKILL via pidfd %d for process %d", handler->pidfd, handler->pid);
if (ret < 0) }
if (ret && (errno != ESRCH) && kill(handler->pid, SIGKILL))
SYSERROR("Failed to send SIGKILL to %d", handler->pid); SYSERROR("Failed to send SIGKILL to %d", handler->pid);
do { do {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment