PR target/29560
[official-gcc.git] / libgo / syscalls / waitpid.go
blob1cb4d5dda9561f591fc40dd5e5518a1e86e222ed
1 // waitpid.go -- Wait4 for systems without wait4, but with waitpid.
3 // Copyright 2011 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 package syscall
9 func libc_waitpid(Pid_t, *int, int) Pid_t __asm__ ("waitpid")
11 func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, errno int) {
12 var status int
13 r := libc_waitpid(Pid_t(pid), &status, options)
14 wpid = int(r)
15 if r < 0 {
16 errno = GetErrno()
18 if wstatus != nil {
19 *wstatus = WaitStatus(status)
21 return