]> Cypherpunks repositories - gostls13.git/commit
os: always return syscall.ECHILD from Wait for done process
authorMichael Pratt <mpratt@google.com>
Mon, 10 Jun 2024 23:52:03 +0000 (23:52 +0000)
committerMichael Pratt <mpratt@google.com>
Tue, 11 Jun 2024 18:08:44 +0000 (18:08 +0000)
commitb788e91badd523e5bb0fc8d50cd76b8ae04ffb20
tree71dc655878364b901a2e0a4d99f4b904d409eede
parent4b8f80707f315a8f7611da4f977892bbb8d49582
os: always return syscall.ECHILD from Wait for done process

For processes that don't exist at lookup time, CL 570036 and CL 588675
make Wait return unconditionally return ErrProcessDone when using pidfd,
rather than attempting to make a wait system call.

This is consistent with Signal/Kill, but inconsistent with the previous
behavior of Wait, which would pass through the kernel error,
syscall.ECHILD.

Switch the ErrProcessDone case to return syscall.ECHILD instead for
consistency with previous behavior.

That said, I do think a future release should consider changing ECHILD
to ErrProcessDone in all cases (including when making an actual wait
system call) for better consistency with Signal/Kill/FindProcess.

Fixes #67926.

Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_14,gotip-solaris-amd64,gotip-openbsd-amd64
Change-Id: I1f688a5751d0f3aecea99c3a5b35c7894cfc2beb
Reviewed-on: https://go-review.googlesource.com/c/go/+/591816
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/os/exec_test.go
src/os/exec_unix_test.go
src/os/pidfd_linux.go
src/os/pidfd_linux_test.go