2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2015 Joyent, Inc.
21 .Nd create and control a process
25 .Ft "struct ps_prochandle *"
27 .Fa "const char *file"
28 .Fa "char *const *argv"
33 .Ft "struct ps_prochandle *"
35 .Fa "const char *file"
36 .Fa "char *const *argv"
37 .Fa "char *const *envp"
44 .Fa "struct ps_prochandle *P"
49 function creates a process controlled by the
54 function does the same while also allowing the replacement of the
58 Both functions cause the caller to
60 Followed by the child calling
62 to load the new process image specified by
68 if it is not an absolute path, similar to
71 The process image will be invoked with the arguments specified by
74 .Dv NULL Ns -terminated
75 array of character strings.
76 Each entry in the array is an individual argument.
77 The environment of the process image will be inherited from the running process
80 function is called or if the
82 function is called and the value of
89 .Dv NULL Ns -terminated
90 array of character strings whose entries are in the form of
92 For more on the process environment, see
97 function allows a way for callers to inject a callback into the child
98 process before the call to
102 is a symbol that may be interposed on by consumers.
103 It allows the chance for the modification of signal dispositions or any other
104 changes that a caller may wish to make.
106 If the caller's real user or group ID is not their effective user or
107 group ID, then the child process's user and group IDs will all be reset
108 to the real user and group id.
119 functions fail, the value pointed to will be filled in with a more
120 detailed error code listed in
122 A human-readable error message is obtained with
123 .Xr Pcreate_error 3PROC .
125 Multiple executables named
129 To determine the full path of the executable pass a non-NULL
132 Upon successful completion of
138 pointer will contain the full path up to
140 bytes, including the NUL character.
142 Upon successful completion of the
146 function, a handle to the process is returned.
147 This handle is usable with other
149 routines and will persist until either
153 is called on the resulting handle.
154 The process created is stopped just after return from the
156 family of system calls.
157 The process will not run, unless the caller sets it running or releases its
158 handle to the process.
160 A 32-bit process cannot use this interface to launch or control a
162 However, a 64-bit process can create and control both 32-bit and 64-bit
165 Upon successful completion, both the
169 functions create a new process and return a
176 is filled in with the corresponding error.
182 functions will fail if:
189 The operation was interrupted by a signal.
191 The calling process is 32-bit, but it attempted to control a 64-bit
196 or the one found by searching
202 does not exist or it could not be found by searching
207 or the one found by searching
209 is set-id or unreadable.
211 An unanticipated system error occurred while trying to create the
212 process and its handle.
213 When this occurs, then the value of
218 for more information and
220 for the list of possible errors.
222 .Sh INTERFACE STABILITY
233 .Xr Pcreate_error 3PROC ,