* [PATCH] include: define pidfd syscalls if needed
@ 2023-08-01 20:08 Markus Mayer
2023-08-03 10:16 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Markus Mayer @ 2023-08-01 20:08 UTC (permalink / raw
To: util-linux mailing list; +Cc: Markus Mayer
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.
Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
include/pidfd-utils.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/pidfd-utils.h b/include/pidfd-utils.h
index 18f3c626ade9..ff0bc4c792fc 100644
--- a/include/pidfd-utils.h
+++ b/include/pidfd-utils.h
@@ -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>
--
2.40.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] include: define pidfd syscalls if needed
2023-08-01 20:08 [PATCH] include: define pidfd syscalls if needed Markus Mayer
@ 2023-08-03 10:16 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2023-08-03 10:16 UTC (permalink / raw
To: Markus Mayer; +Cc: util-linux mailing list
On Tue, Aug 01, 2023 at 01:08:24PM -0700, Markus Mayer wrote:
> include/pidfd-utils.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-03 10:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-01 20:08 [PATCH] include: define pidfd syscalls if needed Markus Mayer
2023-08-03 10:16 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).