os: make FindProcess use pidfd on Linux

Amend FindProcess to use pidfdFind, and make it return ErrProcessDone
if pidfdFind is used and the process is not found.

Since this is a change in API, introduce GODEBUG osfinderr=0 setting
to disable the feature.

Change-Id: I724c6f622f0c99f21a70b864cf7cf2b8836869ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/542699
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Kir Kolyshkin 2023-11-16 01:42:39 -08:00 committed by Michael Pratt
parent ccb6077d11
commit cdf3249d74
7 changed files with 50 additions and 3 deletions

View file

@ -42,6 +42,7 @@ var All = []Info{
{Name: "multipartmaxparts", Package: "mime/multipart"},
{Name: "multipathtcp", Package: "net"},
{Name: "netdns", Package: "net", Opaque: true},
{Name: "osfinderr", Package: "os"},
{Name: "panicnil", Package: "runtime", Changed: 21, Old: "1"},
{Name: "randautoseed", Package: "math/rand"},
{Name: "tarinsecurepath", Package: "archive/tar"},