* libgo patch committed: Check return value as well as error from waitid
@ 2018-07-02 16:29 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2018-07-02 16:29 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 483 bytes --]
This libgo patch checks the return value as well as the error from
waitid. https://gcc.gnu.org/PR86331 indicates that if a signal
handler runs it is possible for syscall.Syscall6 to return a non-zero
errno value even if no error occurs. That is a problem in general, but
this fix will let us work around the general problem for the specific
case of calling waitid. Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu. Committed to trunk, GCC 8 branch, and GCC 7
branch.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1413 bytes --]
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE (revision 262312)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-e1fcce0aec27b1f50ac0e736f39f4c806c2a5baa
+94738979a3422e845acf358a766aabf8b9275d43
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Index: libgo/go/os/wait_waitid.go
===================================================================
--- libgo/go/os/wait_waitid.go (revision 262312)
+++ libgo/go/os/wait_waitid.go (working copy)
@@ -28,9 +28,12 @@ func (p *Process) blockUntilWaitable() (
// We don't care about the values it returns.
var siginfo [16]uint64
psig := &siginfo[0]
- _, _, e := syscall.Syscall6(syscall.SYS_WAITID, _P_PID, uintptr(p.Pid), uintptr(unsafe.Pointer(psig)), syscall.WEXITED|syscall.WNOWAIT, 0, 0)
+ r, _, e := syscall.Syscall6(syscall.SYS_WAITID, _P_PID, uintptr(p.Pid), uintptr(unsafe.Pointer(psig)), syscall.WEXITED|syscall.WNOWAIT, 0, 0)
runtime.KeepAlive(p)
- if e != 0 {
+ // Check r as well as e because syscall.Syscall6 currently
+ // just returns errno, and the SIGCHLD signal handler may
+ // change errno. See https://gcc.gnu.org/PR86331.
+ if r != 0 && e != 0 {
// waitid has been available since Linux 2.6.9, but
// reportedly is not available in Ubuntu on Windows.
// See issue 16610.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-07-02 16:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-02 16:29 libgo patch committed: Check return value as well as error from waitid Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).