unix: add PidfdOpen and PidfdGetfd

Add wrappers for the pidfd_open and pidfd_getfd sycalls, available since 5.3.

PIDFD_NONBLOCK is defined manually since mkerrors.sh doesn't handle including
linux/pidfd.h well.

See https://man7.org/linux/man-pages/man2/pidfd_open.2.html

Change-Id: I68dfb52f6a7a44b7f3324a8379860a1bb765e71b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/347332
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Lorenz Bauer
2021-09-09 19:32:31 +00:00
committed by Ian Lance Taylor
parent aa78b53d33
commit 528a39cd75
17 changed files with 87 additions and 0 deletions
+6
View File
@@ -3829,3 +3829,9 @@ type LandlockPathBeneathAttr C.struct_landlock_path_beneath_attr
const (
LANDLOCK_RULE_PATH_BENEATH = C.LANDLOCK_RULE_PATH_BENEATH
)
// pidfd flags.
const (
PIDFD_NONBLOCK = C.O_NONBLOCK
)