Skip to contentSkip to conversation

include: define pidfd syscalls if needed

PATCH Applied Markus Mayer 2 participants 2 messages Aug 1, 2023 – Aug 3, 2023 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 include: define pidfd syscalls if needed

If the kernel headers are too old to provide the pidfd syscall numbers, let's define them ourselves. This can be helpful while cross-compiling. The runtime environment may provide a kernel that is new enough to handle the calls, even if the toolchain doesn't.

---
 include/pidfd-utils.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
include/pidfd-utils.h +14 -0
index 18f3c626ade9..ff0bc4c792fc 100644
@@ -7,6 +7,20 @@
 
 #ifdef HAVE_SYS_SYSCALL_H
 # include <sys/syscall.h>
+
+/*
+ * If the kernel headers are too old to provide the syscall numbers, let's
+ * define them ourselves. This can be helpful while cross-compiling.
+ */
+#ifndef __NR_pidfd_send_signal
+#define __NR_pidfd_send_signal 424
+#define SYS_pidfd_send_signal __NR_pidfd_send_signal
+#endif
+#ifndef __NR_pidfd_open
+#define __NR_pidfd_open 434
+#define SYS_pidfd_open __NR_pidfd_open
+#endif
+
 # if defined(SYS_pidfd_send_signal) && defined(SYS_pidfd_open)
 #  ifdef HAVE_SYS_PIDFD_H
 #   include <sys/pidfd.h>
Signature · 1 line
2.40.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Markus Mayer
 include/pidfd-utils.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com