libcall_wait4_aix.go 776 B

1234567891011121314151617181920212223242526
  1. // Copyright 2009 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Handle AIX's wait4 specific behavior
  5. package syscall
  6. //sys wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, err error)
  7. //wait4(pid Pid_t, status *_C_int, options _C_int, rusage *Rusage) Pid_t
  8. func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
  9. var status _C_int
  10. var r Pid_t
  11. err = ERESTART
  12. // AIX wait4 may return with ERESTART errno, while the processus is still
  13. // active.
  14. for err == ERESTART {
  15. r, err = wait4(Pid_t(pid), &status, options, rusage)
  16. }
  17. wpid = int(r)
  18. if wstatus != nil {
  19. *wstatus = WaitStatus(status)
  20. }
  21. return
  22. }