aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure3
-rw-r--r--src/sysdeps/trykevent.c19
-rw-r--r--src/sysdeps/trypidfd_open.c9
-rw-r--r--src/sysdeps/tryprsetchildsubreaper.c12
4 files changed, 43 insertions, 0 deletions
diff --git a/configure b/configure
index 53b5194..9f89a61 100755
--- a/configure
+++ b/configure
@@ -717,6 +717,9 @@ choose cl kernprocpathname 'the KERN_PROC_PATHNAME sysctl'
choose cl _nsgetexecutablepath '_NSGetExecutablePath()'
choose cl getexecname 'getexecname()'
choose cl dladdr 'dladdr()'
+choose c pidfd_open 'pidfd_open()'
+choose cl kevent 'kevent()'
+choose cl prsetchildsubreaper 'PR_SET_CHILD_SUBREAPER'
# Here are the evil irreducible run-time sysdeps.
choose clr devurandom '/dev/urandom'
diff --git a/src/sysdeps/trykevent.c b/src/sysdeps/trykevent.c
new file mode 100644
index 0000000..8c54f4d
--- /dev/null
+++ b/src/sysdeps/trykevent.c
@@ -0,0 +1,19 @@
+/* ISC license. */
+
+#undef _POSIX_C_SOURCE
+#undef _XOPEN_SOURCE
+
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+int main (void)
+{
+ int q = kqueue() ;
+ struct kevent ke ;
+ struct timespec ts = { .tv_sec = 1, .tv_nsec = 0 } ;
+ EV_SET(&ke, getpid(), EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, 0) ;
+ kevent(q, &ke, 1, &ke, 1, &ts) ;
+ return 0 ;
+}
diff --git a/src/sysdeps/trypidfd_open.c b/src/sysdeps/trypidfd_open.c
new file mode 100644
index 0000000..8840742
--- /dev/null
+++ b/src/sysdeps/trypidfd_open.c
@@ -0,0 +1,9 @@
+/* ISC license. */
+
+#undef _POSIX_C_SOURCE
+#undef _XOPEN_SOURCE
+
+#include <sys/syscall.h>
+#include <unistd.h>
+
+static long a = SYS_pidfd_open ;
diff --git a/src/sysdeps/tryprsetchildsubreaper.c b/src/sysdeps/tryprsetchildsubreaper.c
new file mode 100644
index 0000000..6a65691
--- /dev/null
+++ b/src/sysdeps/tryprsetchildsubreaper.c
@@ -0,0 +1,12 @@
+/* ISC license. */
+
+#undef _POSIX_C_SOURCE
+#undef _XOPEN_SOURCE
+
+#include <sys/prctl.h>
+
+int main (void)
+{
+ prctl(PR_SET_CHILD_SUBREAPER, 1) ;
+ return 0 ;
+}