From: Thomas Weißschuh Date: Mon, 13 May 2024 18:21:24 +0000 (+0200) Subject: include/pidfd-utils: provide ENOSYS stubs if pidfd functions are missing X-Git-Tag: v2.42-start~340^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e8c092266e28589abd5ca149ee8b3a43a9a6ee0;p=thirdparty%2Futil-linux.git include/pidfd-utils: provide ENOSYS stubs if pidfd functions are missing This allows code which can gracefully fall back to compile. This should fix the CI on Ubuntu 18.04. Signed-off-by: Thomas Weißschuh --- diff --git a/include/pidfd-utils.h b/include/pidfd-utils.h index 4f6f51b81..4ac9f79d9 100644 --- a/include/pidfd-utils.h +++ b/include/pidfd-utils.h @@ -5,6 +5,9 @@ #ifndef UTIL_LINUX_PIDFD_UTILS #define UTIL_LINUX_PIDFD_UTILS +#include +#include + #ifdef HAVE_SYS_SYSCALL_H # include # include @@ -13,9 +16,7 @@ # ifdef HAVE_SYS_PIDFD_H # include # endif -# include # ifndef HAVE_PIDFD_SEND_SIGNAL -# include static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info, unsigned int flags) { @@ -34,4 +35,23 @@ static inline int pidfd_open(pid_t pid, unsigned int flags) # endif /* SYS_pidfd_send_signal */ #endif /* HAVE_SYS_SYSCALL_H */ + +#ifndef UL_HAVE_PIDFD +static inline int pidfd_send_signal(int pidfd __attribute__((unused)), + int sig __attribute__((unused)), + siginfo_t *info __attribute__((unused)), + unsigned int flags __attribute__((unused))) +{ + errno = ENOSYS; + return -1; +} + +static inline int pidfd_open(pid_t pid __attribute__((unused)), + unsigned int flags __attribute__((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #endif /* UTIL_LINUX_PIDFD_UTILS */