diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-10-25 16:06:06 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-12-04 10:33:41 +0100 |
commit | 5f152f43d04e5aad6a3f98f45f020a66e3aac717 (patch) | |
tree | da4cd9525b3a570fa21e4725a438bb30f6bf8988 /src/basic/missing_syscall.h | |
parent | 5a795bff38402d1a7e82020888eb1da5d52ad4a7 (diff) | |
download | systemd-5f152f43d04e5aad6a3f98f45f020a66e3aac717.tar.gz |
missing: define new pidfd syscalls
Diffstat (limited to 'src/basic/missing_syscall.h')
-rw-r--r-- | src/basic/missing_syscall.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h index 1255d8b197..bea7be699d 100644 --- a/src/basic/missing_syscall.h +++ b/src/basic/missing_syscall.h @@ -5,8 +5,10 @@ #include <errno.h> #include <fcntl.h> +#include <signal.h> #include <sys/syscall.h> #include <sys/types.h> +#include <sys/wait.h> #include <unistd.h> #ifdef ARCH_MIPS @@ -524,3 +526,39 @@ static inline long missing_get_mempolicy(int *mode, unsigned long *nodemask, #define get_mempolicy missing_get_mempolicy #endif + +#if !HAVE_PIDFD_OPEN +/* may be (invalid) negative number due to libseccomp, see PR 13319 */ +# if ! (defined __NR_pidfd_open && __NR_pidfd_open > 0) +# if defined __NR_pidfd_open +# undef __NR_pidfd_open +# endif +# define __NR_pidfd_open 434 +#endif +static inline int pidfd_open(pid_t pid, unsigned flags) { +#ifdef __NR_pidfd_open + return syscall(__NR_pidfd_open, pid, flags); +#else + errno = ENOSYS; + return -1; +#endif +} +#endif + +#if !HAVE_PIDFD_SEND_SIGNAL +/* may be (invalid) negative number due to libseccomp, see PR 13319 */ +# if ! (defined __NR_pidfd_send_signal && __NR_pidfd_send_signal > 0) +# if defined __NR_pidfd_send_signal +# undef __NR_pidfd_send_signal +# endif +# define __NR_pidfd_send_signal 424 +#endif +static inline int pidfd_send_signal(int fd, int sig, siginfo_t *info, unsigned flags) { +#ifdef __NR_pidfd_open + return syscall(__NR_pidfd_send_signal, fd, sig, info, flags); +#else + errno = ENOSYS; + return -1; +#endif +} +#endif |