From 97f5d19c45799e3abedef771430b5562f1b8764f Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 28 Jan 2022 15:27:40 -0300 Subject: linux: Add pidfd_open This was added on Linux 5.3 (32fcb426ec001cb6d5a4a195091a8486ea77e2df) as a way to retrieve a pid file descriptors for process that has not been created CLONE_PIDFD (by usual fork/clone). Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/sys/pidfd.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/sys/pidfd.h (limited to 'sysdeps/unix/sysv/linux/sys') diff --git a/sysdeps/unix/sysv/linux/sys/pidfd.h b/sysdeps/unix/sysv/linux/sys/pidfd.h new file mode 100644 index 0000000..dab2710 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sys/pidfd.h @@ -0,0 +1,33 @@ +/* Wrapper for file descriptors that refers to a process functions. + Copyright (C) 2022 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _PIDFD_H + +#include +#include + +#define PIDFD_NONBLOCK O_NONBLOCK + +/* Returns a file descriptor that refers to the process PID. The + close-on-exec is set on the file descriptor. + + The FLAGS argument is reserved for future use, it must be specified + as 0. */ +extern int pidfd_open (__pid_t __pid, unsigned int __flags) __THROW; + +#endif /* _PIDFD_H */ -- cgit v1.1