2 .\" Copyright (c) 2009-2010, 2012-2013 Robert N. M. Watson
3 .\" All rights reserved.
5 .\" This software was developed at the University of Cambridge Computer
6 .\" Laboratory with support from a grant from Google, Inc.
8 .\" This software was developed by SRI International and the University of
9 .\" Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
10 .\" ("CTSRD"), as part of the DARPA CRASH research programme.
12 .\" Redistribution and use in source and binary forms, with or without
13 .\" modification, are permitted provided that the following conditions
15 .\" 1. Redistributions of source code must retain the above copyright
16 .\" notice, this list of conditions and the following disclaimer.
17 .\" 2. Redistributions in binary form must reproduce the above copyright
18 .\" notice, this list of conditions and the following disclaimer in the
19 .\" documentation and/or other materials provided with the distribution.
21 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 .Nd System calls to manage process descriptors
48 .Fn pdfork "int *fdp" "int flags"
50 .Fn pdgetpid "int fd" "pid_t *pidp"
52 .Fn pdkill "int fd" "int signum"
54 Process descriptors are special file descriptors that represent processes,
59 which, if successful, returns a process descriptor in the integer pointed to
69 .Bl -tag -width ".Dv PD_DAEMON"
71 Instead of the default terminate-on-close behaviour, allow the process to
72 live until it is explicitly killed with
75 This option is not permitted in
80 .Bl -tag -width ".Dv PD_DAEMON"
82 Set close-on-exec on process descriptor.
86 queries the process ID (PID) in the process descriptor
90 is functionally identical to
92 except that it accepts a process descriptor,
96 The following system calls also have effects specific to process descriptors:
99 queries status of a process descriptor; currently only the
107 If the owner read, write, and execute bits are set then the
108 process represented by the process descriptor is still alive.
113 allow waiting for process state transitions; currently only
115 is defined, and will be raised when the process dies.
116 Process state transitions can also be monitored using
119 .Dv EVFILT_PROCDESC ;
125 will close the process descriptor unless
127 is set; if the process is still alive and this is
128 the last reference to the process descriptor, the process will be terminated
133 returns a PID, 0 or -1, as
140 return 0 on success and -1 on failure.
142 These functions may return the same error numbers as their PID-based equivalents
145 may return the same error numbers as
147 with the following additions:
150 The signal number given to
153 .It Bq Er ENOTCAPABLE
154 The process descriptor being operated on has insufficient rights (e.g.
175 system calls first appeared in
178 Support for process descriptors mode was developed as part of the
183 These functions and the capability facility were created by
184 .An Robert N. M. Watson Aq Mt rwatson@FreeBSD.org
186 .An Jonathan Anderson Aq Mt jonathan@FreeBSD.org
187 at the University of Cambridge Computer Laboratory with support from a grant