1 /* Wrapper for file descriptors that refers to a process functions.
2 Copyright (C) 2022-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
22 #include <bits/types/siginfo_t.h>
24 #define PIDFD_NONBLOCK O_NONBLOCK
26 /* Returns a file descriptor that refers to the process PID. The
27 close-on-exec is set on the file descriptor.
29 The FLAGS argument is reserved for future use, it must be specified
31 extern int pidfd_open (__pid_t __pid
, unsigned int __flags
) __THROW
;
33 /* Duplicates an existing file descriptor TARGETFD in the process referred
34 by the PIDFD file descriptor PIDFD.
36 The FLAGS argument is reserved for future use, it must be specified
38 extern int pidfd_getfd (int __pidfd
, int __targetfd
,
39 unsigned int __flags
) __THROW
;
41 /* Sends the signal SIG to the target process referred by the PIDFD. If
42 INFO points to a siginfo_t buffer, it will be populated.
44 The FLAGS argument is reserved for future use, it must be specified
46 extern int pidfd_send_signal (int __pidfd
, int __sig
, siginfo_t
*__info
,
47 unsigned int __flags
) __THROW
;
49 /* Query the process ID (PID) from process descriptor FD. Return the PID
50 or -1 in case of an error. */
51 extern pid_t
pidfd_getpid (int __fd
) __THROW
;