2011-05-31 Gabriel Charette <gchare@google.com>
[official-gcc.git] / libgo / syscalls / wait4.go
blobbb00c792bc001c6f7e18bb49a519d5857d588e31
1 // wait4.go -- Wait4 for systems with wait4.
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_wait4(Pid_t, *int, int, *Rusage) Pid_t __asm__ ("wait4")
11 func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, errno int) {
12 var status int
13 r := libc_wait4(Pid_t(pid), &status, options, rusage)
14 wpid = int(r)
15 if r < 0 {
16 errno = GetErrno()
18 if wstatus != nil {
19 *wstatus = WaitStatus(status)
21 return