Source file
src/os/wait_wait6.go
1
2
3
4
5
6
7 package os
8
9 import (
10 "runtime"
11 "syscall"
12 )
13
14 const _P_PID = 0
15
16
17
18
19 func (p *Process) blockUntilWaitable() (bool, error) {
20 var errno syscall.Errno
21 for {
22
23
24
25 if runtime.GOOS == "freebsd" && runtime.GOARCH == "386" {
26 _, _, errno = syscall.Syscall9(syscall.SYS_WAIT6, _P_PID, uintptr(p.Pid), 0, 0, syscall.WEXITED|syscall.WNOWAIT, 0, 0, 0, 0)
27 } else if runtime.GOOS == "freebsd" && runtime.GOARCH == "arm" {
28 _, _, errno = syscall.Syscall9(syscall.SYS_WAIT6, _P_PID, 0, uintptr(p.Pid), 0, 0, syscall.WEXITED|syscall.WNOWAIT, 0, 0, 0)
29 } else {
30 _, _, errno = syscall.Syscall6(syscall.SYS_WAIT6, _P_PID, uintptr(p.Pid), 0, syscall.WEXITED|syscall.WNOWAIT, 0, 0)
31 }
32 if errno != syscall.EINTR {
33 break
34 }
35 }
36 runtime.KeepAlive(p)
37 if errno == syscall.ENOSYS {
38 return false, nil
39 } else if errno != 0 {
40 return false, NewSyscallError("wait6", errno)
41 }
42 return true, nil
43 }
44
View as plain text