Main index | Section 2 | Options |
#include <sys/procdesc.h>
PD_DAEMON | |
Instead of the default terminate-on-close behaviour, allow the process to
live until it is explicitly killed with
kill(2).
This option is not permitted in capsicum(4) capability mode (see cap_enter(2)). | |
PD_CLOEXEC | |
Set close-on-exec on process descriptor. | |
pdgetpid() queries the process ID (PID) in the process descriptor fd.
pdkill() is functionally identical to kill(2), except that it accepts a process descriptor, fd, rather than a PID.
The following system calls also have effects specific to process descriptors:
fstat(2) queries status of a process descriptor; currently only the st_mode, st_birthtime, st_atime, st_ctime and st_mtime fields are defined. If the owner read, write, and execute bits are set then the process represented by the process descriptor is still alive.
poll(2) and select(2) allow waiting for process state transitions; currently only POLLHUP is defined, and will be raised when the process dies. Process state transitions can also be monitored using kqueue(2) filter EVFILT_PROCDESC; currently only NOTE_EXIT is implemented.
close(2) will close the process descriptor unless PD_DAEMON is set; if the process is still alive and this is the last reference to the process descriptor, the process will be terminated with the signal SIGKILL.
pdgetpid() and pdkill() return 0 on success and -1 on failure.
[EINVAL] | |
The signal number given to pdkill() is invalid. | |
[ENOTCAPABLE] | |
The process descriptor being operated on has insufficient rights (e.g. CAP_PDKILL for pdkill()). | |
Support for process descriptors mode was developed as part of the TrustedBSD Project.
PDFORK (2) | October 14, 2018 |
Main index | Section 2 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs. | ” |
— Maurice Wilkes |