Documentation
¶
Index ¶
Constants ¶
const PPIDFD int = 3
PPIDFD is the first argument to waitid for pidfd.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Epoller ¶
type Epoller struct {
// contains filtered or unexported fields
}
Epoller is used to monitor PID file descriptors.
When the process that PID file descriptor refers to terminates, these interfaces indicate the file descriptor as readable. Then Epoller will close the PID file descriptor and call the callback.
func NewEpoller ¶
type FD ¶
type FD int
func Open ¶
Open creates a file descriptor that refers to the process whose PID is specified in pid. The file descriptor is returned as the function result; the close-on-exec flag is set on the file descriptor.
func (FD) SendSignal ¶
SendSignal sends a signal to a process specified by a file descriptor.
The flags argument is reserved for future use; currently, this argument must be specified as 0.
type Siginfo ¶
type Siginfo struct { Signo int32 Errno int32 Code int32 Pid uint32 // contains filtered or unexported fields }
Siginfo extends the unix.Siginfo with Pid, which used to check the process state.
From https://man7.org/linux/man-pages/man2/waitid.2.html:
If WNOHANG was specified in options and there were no children in a waitable state, then waitid() returns 0 immediately and the state of the siginfo_t structure pointed to by infop depends on the implementation. To (portably) distinguish this case from that where a child was in a waitable state, zero out the si_pid field before the call and check for a nonzero value in this field after the call returns.