]> Cypherpunks repositories - gostls13.git/commit
os: make FindProcess use pidfd on Linux
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 16 Nov 2023 09:42:39 +0000 (01:42 -0800)
committerMichael Pratt <mpratt@google.com>
Tue, 21 May 2024 15:09:50 +0000 (15:09 +0000)
commitdbe2e757bb55f80de1a622da6bd5060e979208d1
treeb0d30b44be5ab85c34b8df89e1b34489a8b381cc
parent0bc684a994c47a079cd7ead2016cc77db0a3d36c
os: make FindProcess use pidfd on Linux

This is a continuation of CL 570036.

Amend FindProcess to use pidfdFind, and make it return a special
Process with Pid of pidDone (-2) if the process is not found.

Amend Wait and Signal to return ErrProcessDone if pid == pidDone.

The alternative to the above would be to make FindProcess return
ErrProcessDone, but this is unexpected and incompatible API change,
as discussed in #65866 and #51246.

For #62654.

Rework of CL 542699 (which got reverted in CL 566476).

Change-Id: Ifb4cd3ad1433152fd72ee685d0b85d20377f8723
Reviewed-on: https://go-review.googlesource.com/c/go/+/570681
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/os/exec_unix.go
src/os/exec_unix_test.go
src/os/export_linux_test.go
src/os/pidfd_linux.go
src/os/pidfd_linux_test.go
src/os/pidfd_other.go