1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

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 <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Adhemerval Zanella
2022-01-28 15:27:40 -03:00
parent 1da064c015
commit 97f5d19c45
39 changed files with 133 additions and 1 deletions

View File

@ -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
<https://www.gnu.org/licenses/>. */
#ifndef _PIDFD_H
#include <fcntl.h>
#include <bits/types/siginfo_t.h>
#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 */