From 4091dcd4699cc04d59068f86fa6d5e6c578e4eca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 15 Aug 2020 19:01:23 +0200 Subject: [PATCH] missing_syscall: fix pidfd_{send_signal,open} numbers for alpha Also order the syscalls by syscall number for easier comparisons with the kernel headers. Fixup for 5f152f43d04e5aad6a3f98f45f020a66e3aac717. (cherry picked from commit 23654cee136862996d92e7f1e9887786ddb3dfe6) --- src/basic/missing_syscall.h | 54 ++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h index 41164ea7d0..9bc431c12f 100644 --- a/src/basic/missing_syscall.h +++ b/src/basic/missing_syscall.h @@ -527,39 +527,49 @@ 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 +/* should be always defined, see kernel 39036cd2727395c3369b1051005da74059a85317 */ +# if defined(__alpha__) +# define __NR_pidfd_send_signal 534 +# else +# define __NR_pidfd_send_signal 424 +# endif +# endif static inline int pidfd_send_signal(int fd, int sig, siginfo_t *info, unsigned flags) { -#ifdef __NR_pidfd_open +# ifdef __NR_pidfd_open return syscall(__NR_pidfd_send_signal, fd, sig, info, flags); -#else +# else errno = ENOSYS; return -1; +# endif +} #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 +/* should be always defined, see kernel 7615d9e1780e26e0178c93c55b73309a5dc093d7 */ +# if defined(__alpha__) +# define __NR_pidfd_open 544 +# else +# define __NR_pidfd_open 434 +# endif +# 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 -- 2.25.1