]> Cypherpunks repositories - gostls13.git/commitdiff
os: check for waitid returning ENOSYS
authorIan Lance Taylor <iant@golang.org>
Fri, 5 Aug 2016 02:53:52 +0000 (19:53 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 5 Aug 2016 19:48:42 +0000 (19:48 +0000)
Reportedly waitid is not available for Ubuntu on Windows.

Fixes #16610.

Change-Id: Ia724f45a85c6d3467b847da06d8c65d280781dcd
Reviewed-on: https://go-review.googlesource.com/25507
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/os/wait_waitid.go

index 5dbd7f97662989d8b977277da4bc92daf80aa4e2..74b7494c0de8c2be91275b0debf20faa47856763 100644 (file)
@@ -28,6 +28,12 @@ func (p *Process) blockUntilWaitable() (bool, error) {
        _, _, e := syscall.Syscall6(syscall.SYS_WAITID, _P_PID, uintptr(p.Pid), uintptr(unsafe.Pointer(psig)), syscall.WEXITED|syscall.WNOWAIT, 0, 0)
        runtime.KeepAlive(psig)
        if e != 0 {
+               // waitid has been available since Linux 2.6.9, but
+               // reportedly is not available in Ubuntu on Windows.
+               // See issue 16610.
+               if e == syscall.ENOSYS {
+                       return false, nil
+               }
                return false, NewSyscallError("waitid", e)
        }
        return true, nil