summaryrefslogtreecommitdiffstats
path: root/include/pidfd-utils.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
commit378c18e5f024ac5a8aef4cb40d7c9aa9633d144c (patch)
tree44dfb6ca500d32cabd450649b322a42e70a30683 /include/pidfd-utils.h
parentInitial commit. (diff)
downloadutil-linux-upstream.tar.xz
util-linux-upstream.zip
Adding upstream version 2.38.1.upstream/2.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--include/pidfd-utils.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/pidfd-utils.h b/include/pidfd-utils.h
new file mode 100644
index 0000000..eddede9
--- /dev/null
+++ b/include/pidfd-utils.h
@@ -0,0 +1,28 @@
+#ifndef UTIL_LINUX_PIDFD_UTILS
+#define UTIL_LINUX_PIDFD_UTILS
+
+#ifdef HAVE_SYS_SYSCALL_H
+# include <sys/syscall.h>
+# if defined(SYS_pidfd_send_signal) && defined(SYS_pidfd_open)
+# include <sys/types.h>
+
+# ifndef HAVE_PIDFD_SEND_SIGNAL
+static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
+ unsigned int flags)
+{
+ return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags);
+}
+# endif
+
+# ifndef HAVE_PIDFD_OPEN
+static inline int pidfd_open(pid_t pid, unsigned int flags)
+{
+ return syscall(SYS_pidfd_open, pid, flags);
+}
+# endif
+
+# define UL_HAVE_PIDFD 1
+
+# endif /* SYS_pidfd_send_signal */
+#endif /* HAVE_SYS_SYSCALL_H */
+#endif /* UTIL_LINUX_PIDFD_UTILS */