github.com/xyproto/u-root@v6.0.1-0.20200302025726-5528e0c77a3c+incompatible/pkg/strace/strace_unix.go (about)

     1  // Copyright 2018 the u-root 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  
     5  package strace
     6  
     7  import (
     8  	"syscall"
     9  
    10  	"golang.org/x/sys/unix"
    11  )
    12  
    13  // Wait will wait for the specified pid using Wait4.
    14  // Callers may specify the full range of values
    15  // as specified in the waipid man page, though
    16  // we typically use only -1 or a valid pid.
    17  func Wait(wpid int) (int, unix.WaitStatus, error) {
    18  	var w syscall.WaitStatus
    19  	pid, err := syscall.Wait4(wpid, &w, 0, nil)
    20  	uw := unix.WaitStatus(w)
    21  	return pid, uw, err
    22  }