| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: exec.3,v 1.24 2014/09/26 23:57:26 christos Exp $ | | 1 | .\" $NetBSD: exec.3,v 1.25 2014/09/27 08:46:56 wiz Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 1991, 1993 | | 3 | .\" Copyright (c) 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | | 4 | .\" The Regents of the University of California. All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" 1. Redistributions of source code must retain the above copyright | | 9 | .\" 1. Redistributions of source code must retain the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer. | | 10 | .\" notice, this list of conditions and the following disclaimer. |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" 3. Neither the name of the University nor the names of its contributors | | 14 | .\" 3. Neither the name of the University nor the names of its contributors |
| @@ -50,27 +50,27 @@ | | | @@ -50,27 +50,27 @@ |
50 | .Ft int | | 50 | .Ft int |
51 | .Fn execlp "const char *file" "const char *arg" ... | | 51 | .Fn execlp "const char *file" "const char *arg" ... |
52 | .Ft int | | 52 | .Ft int |
53 | .Fn execlpe "const char *path" "const char *arg" ... "char *const envp[]" | | 53 | .Fn execlpe "const char *path" "const char *arg" ... "char *const envp[]" |
54 | .Ft int | | 54 | .Ft int |
55 | .Fn execle "const char *path" "const char *arg" ... "char *const envp[]" | | 55 | .Fn execle "const char *path" "const char *arg" ... "char *const envp[]" |
56 | .Ft int | | 56 | .Ft int |
57 | .Fn exect "const char *path" "char *const argv[]" "char *const envp[]" | | 57 | .Fn exect "const char *path" "char *const argv[]" "char *const envp[]" |
58 | .Ft int | | 58 | .Ft int |
59 | .Fn execv "const char *path" "char *const argv[]" | | 59 | .Fn execv "const char *path" "char *const argv[]" |
60 | .Ft int | | 60 | .Ft int |
61 | .Fn execvp "const char *file" "char *const argv[]" | | 61 | .Fn execvp "const char *file" "char *const argv[]" |
62 | .Ft int | | 62 | .Ft int |
63 | .Fn execvpe "const char *file" "char *const argv[], char *const envp[]" | | 63 | .Fn execvpe "const char *file" "char *const argv[]" "char *const envp[]" |
64 | .Sh DESCRIPTION | | 64 | .Sh DESCRIPTION |
65 | The | | 65 | The |
66 | .Fn exec | | 66 | .Fn exec |
67 | family of functions replaces the current process image with a | | 67 | family of functions replaces the current process image with a |
68 | new process image. | | 68 | new process image. |
69 | The functions described in this manual page are front-ends for the function | | 69 | The functions described in this manual page are front-ends for the function |
70 | .Xr execve 2 . | | 70 | .Xr execve 2 . |
71 | (See the manual page for | | 71 | (See the manual page for |
72 | .Xr execve 2 | | 72 | .Xr execve 2 |
73 | for detailed information about the replacement of the current process. | | 73 | for detailed information about the replacement of the current process. |
74 | The | | 74 | The |
75 | .Xr script 7 | | 75 | .Xr script 7 |
76 | manual page provides detailed information about the execution of | | 76 | manual page provides detailed information about the execution of |
| @@ -110,51 +110,51 @@ and | | | @@ -110,51 +110,51 @@ and |
110 | .Fn execvpe | | 110 | .Fn execvpe |
111 | functions provide an array of pointers to null-terminated strings that | | 111 | functions provide an array of pointers to null-terminated strings that |
112 | represent the argument list available to the new program. | | 112 | represent the argument list available to the new program. |
113 | The first argument, by convention, should point to the file name associated | | 113 | The first argument, by convention, should point to the file name associated |
114 | with the file being executed. | | 114 | with the file being executed. |
115 | The array of pointers | | 115 | The array of pointers |
116 | .Sy must | | 116 | .Sy must |
117 | be terminated by a | | 117 | be terminated by a |
118 | .Dv NULL | | 118 | .Dv NULL |
119 | pointer. | | 119 | pointer. |
120 | .Pp | | 120 | .Pp |
121 | The | | 121 | The |
122 | .Fn execle , | | 122 | .Fn execle , |
123 | .Fn execlpe | | 123 | .Fn execlpe , |
124 | and | | 124 | and |
125 | .Fn exect | | 125 | .Fn exect |
126 | functions also specify the environment of the executed process by following | | 126 | functions also specify the environment of the executed process by following |
127 | the | | 127 | the |
128 | .Dv NULL | | 128 | .Dv NULL |
129 | pointer that terminates the list of arguments in the parameter list | | 129 | pointer that terminates the list of arguments in the parameter list |
130 | or the pointer to the argv array with an additional parameter. | | 130 | or the pointer to the argv array with an additional parameter. |
131 | This additional parameter is an array of pointers to null-terminated strings | | 131 | This additional parameter is an array of pointers to null-terminated strings |
132 | and | | 132 | and |
133 | .Em must | | 133 | .Em must |
134 | be terminated by a | | 134 | be terminated by a |
135 | .Dv NULL | | 135 | .Dv NULL |
136 | pointer. | | 136 | pointer. |
137 | The other functions take the environment for the new process image from the | | 137 | The other functions take the environment for the new process image from the |
138 | external variable | | 138 | external variable |
139 | .Va environ | | 139 | .Va environ |
140 | in the current process. | | 140 | in the current process. |
141 | .Pp | | 141 | .Pp |
142 | Some of these functions have special semantics. | | 142 | Some of these functions have special semantics. |
143 | .Pp | | 143 | .Pp |
144 | The functions | | 144 | The functions |
145 | .Fn execlp , | | 145 | .Fn execlp , |
146 | .Fn execlpe , | | 146 | .Fn execlpe , |
147 | .Fn execvp | | 147 | .Fn execvp , |
148 | and | | 148 | and |
149 | .Fn execvpe | | 149 | .Fn execvpe |
150 | will duplicate the actions of the shell in searching for an executable file | | 150 | will duplicate the actions of the shell in searching for an executable file |
151 | if the specified file name does not contain a slash | | 151 | if the specified file name does not contain a slash |
152 | .Dq Li \&/ | | 152 | .Dq Li \&/ |
153 | character. | | 153 | character. |
154 | The search path is the path specified in the environment by the | | 154 | The search path is the path specified in the environment by the |
155 | .Ev PATH | | 155 | .Ev PATH |
156 | variable. | | 156 | variable. |
157 | If this variable isn't specified, | | 157 | If this variable isn't specified, |
158 | .Va _PATH_DEFPATH | | 158 | .Va _PATH_DEFPATH |
159 | from | | 159 | from |
160 | .In paths.h | | 160 | .In paths.h |
| @@ -234,27 +234,27 @@ Traditionally, the functions | | | @@ -234,27 +234,27 @@ Traditionally, the functions |
234 | and | | 234 | and |
235 | .Fn execvpe | | 235 | .Fn execvpe |
236 | ignored all errors except for the ones described above and | | 236 | ignored all errors except for the ones described above and |
237 | .Er ENOMEM | | 237 | .Er ENOMEM |
238 | and | | 238 | and |
239 | .Er E2BIG , | | 239 | .Er E2BIG , |
240 | upon which they returned. | | 240 | upon which they returned. |
241 | They now return if any error other than the ones described above occurs. | | 241 | They now return if any error other than the ones described above occurs. |
242 | .Sh ERRORS | | 242 | .Sh ERRORS |
243 | .Fn execl , | | 243 | .Fn execl , |
244 | .Fn execle , | | 244 | .Fn execle , |
245 | .Fn execlp , | | 245 | .Fn execlp , |
246 | .Fn execlpe , | | 246 | .Fn execlpe , |
247 | .Fn execvp | | 247 | .Fn execvp , |
248 | and | | 248 | and |
249 | .Fn execvpe | | 249 | .Fn execvpe |
250 | may fail and set | | 250 | may fail and set |
251 | .Va errno | | 251 | .Va errno |
252 | for any of the errors specified for the library functions | | 252 | for any of the errors specified for the library functions |
253 | .Xr execve 2 | | 253 | .Xr execve 2 |
254 | and | | 254 | and |
255 | .Xr malloc 3 . | | 255 | .Xr malloc 3 . |
256 | .Pp | | 256 | .Pp |
257 | .Fn exect | | 257 | .Fn exect |
258 | and | | 258 | and |
259 | .Fn execv | | 259 | .Fn execv |
260 | may fail and set | | 260 | may fail and set |
| @@ -262,26 +262,26 @@ may fail and set | | | @@ -262,26 +262,26 @@ may fail and set |
262 | for any of the errors specified for the library function | | 262 | for any of the errors specified for the library function |
263 | .Xr execve 2 . | | 263 | .Xr execve 2 . |
264 | .Sh SEE ALSO | | 264 | .Sh SEE ALSO |
265 | .Xr sh 1 , | | 265 | .Xr sh 1 , |
266 | .Xr execve 2 , | | 266 | .Xr execve 2 , |
267 | .Xr fork 2 , | | 267 | .Xr fork 2 , |
268 | .Xr ptrace 2 , | | 268 | .Xr ptrace 2 , |
269 | .Xr environ 7 , | | 269 | .Xr environ 7 , |
270 | .Xr script 7 | | 270 | .Xr script 7 |
271 | .Sh STANDARDS | | 271 | .Sh STANDARDS |
272 | .Fn execl , | | 272 | .Fn execl , |
273 | .Fn execv , | | 273 | .Fn execv , |
274 | .Fn execle , | | 274 | .Fn execle , |
275 | .Fn execlp | | 275 | .Fn execlp , |
276 | and | | 276 | and |
277 | .Fn execvp | | 277 | .Fn execvp |
278 | conform to | | 278 | conform to |
279 | .St -p1003.1-90 . | | 279 | .St -p1003.1-90 . |
280 | .Pp | | 280 | .Pp |
281 | The | | 281 | The |
282 | .Fn execlpe | | 282 | .Fn execlpe |
283 | function appeared first in QNX and the | | 283 | function appeared first in QNX and the |
284 | .Fn execvpe | | 284 | .Fn execvpe |
285 | is on both | | 285 | function exists on both |
286 | .Lx | | 286 | .Lx |
287 | and QNX. | | 287 | and QNX. |