diff options
Diffstat (limited to 'src/lib/libc/stdlib/system.3')
| -rw-r--r-- | src/lib/libc/stdlib/system.3 | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/src/lib/libc/stdlib/system.3 b/src/lib/libc/stdlib/system.3 index 520f51db0a..a49e595bc0 100644 --- a/src/lib/libc/stdlib/system.3 +++ b/src/lib/libc/stdlib/system.3 | |||
| @@ -13,11 +13,7 @@ | |||
| 13 | .\" 2. Redistributions in binary form must reproduce the above copyright | 13 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 14 | .\" notice, this list of conditions and the following disclaimer in the | 14 | .\" notice, this list of conditions and the following disclaimer in the |
| 15 | .\" documentation and/or other materials provided with the distribution. | 15 | .\" documentation and/or other materials provided with the distribution. |
| 16 | .\" 3. All advertising materials mentioning features or use of this software | 16 | .\" 3. Neither the name of the University nor the names of its contributors |
| 17 | .\" must display the following acknowledgement: | ||
| 18 | .\" This product includes software developed by the University of | ||
| 19 | .\" California, Berkeley and its contributors. | ||
| 20 | .\" 4. Neither the name of the University nor the names of its contributors | ||
| 21 | .\" may be used to endorse or promote products derived from this software | 17 | .\" may be used to endorse or promote products derived from this software |
| 22 | .\" without specific prior written permission. | 18 | .\" without specific prior written permission. |
| 23 | .\" | 19 | .\" |
| @@ -33,10 +29,9 @@ | |||
| 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | .\" SUCH DAMAGE. | 30 | .\" SUCH DAMAGE. |
| 35 | .\" | 31 | .\" |
| 36 | .\" from: @(#)system.3 6.5 (Berkeley) 6/29/91 | 32 | .\" $OpenBSD: system.3,v 1.11 2008/04/04 19:30:41 kurt Exp $ |
| 37 | .\" $Id: system.3,v 1.1.1.1 1995/10/18 08:42:20 deraadt Exp $ | ||
| 38 | .\" | 33 | .\" |
| 39 | .Dd June 29, 1991 | 34 | .Dd $Mdocdate: April 4 2008 $ |
| 40 | .Dt SYSTEM 3 | 35 | .Dt SYSTEM 3 |
| 41 | .Os | 36 | .Os |
| 42 | .Sh NAME | 37 | .Sh NAME |
| @@ -49,8 +44,7 @@ | |||
| 49 | .Sh DESCRIPTION | 44 | .Sh DESCRIPTION |
| 50 | The | 45 | The |
| 51 | .Fn system | 46 | .Fn system |
| 52 | function | 47 | function hands the argument |
| 53 | hands the argument | ||
| 54 | .Fa string | 48 | .Fa string |
| 55 | to the command interpreter | 49 | to the command interpreter |
| 56 | .Xr sh 1 . | 50 | .Xr sh 1 . |
| @@ -64,36 +58,47 @@ and blocking | |||
| 64 | .Pp | 58 | .Pp |
| 65 | If | 59 | If |
| 66 | .Fa string | 60 | .Fa string |
| 67 | is a | 61 | is |
| 68 | .Dv NULL | 62 | .Dv NULL , |
| 69 | pointer, | ||
| 70 | .Fn system | 63 | .Fn system |
| 71 | will return non-zero. | 64 | will return non-zero. |
| 72 | Otherwise, | 65 | Otherwise, |
| 73 | .Fn system | 66 | .Fn system |
| 74 | returns the termination status of the shell in the format specified by | 67 | returns the termination status of the shell in the format specified by |
| 75 | .Xr waitpid 3 . | 68 | .Xr waitpid 2 . |
| 76 | .Sh RETURN VALUES | 69 | .Pp |
| 70 | Note that fork handlers established using | ||
| 71 | .Xr pthread_atfork 3 | ||
| 72 | are not called when a multithreaded program calls | ||
| 73 | .Fn system . | ||
| 74 | .Sh RETURN VALUES | ||
| 77 | If a child process cannot be created, or the termination status of | 75 | If a child process cannot be created, or the termination status of |
| 78 | the shell cannot be obtained, | 76 | the shell cannot be obtained, |
| 79 | .Fn system | 77 | .Fn system |
| 80 | returns -1 and sets | 78 | returns \-1 and sets |
| 81 | .Va errno | 79 | .Va errno |
| 82 | to indicate the error. | 80 | to indicate the error. |
| 83 | If execution of the shell fails, | 81 | If execution of the shell fails, |
| 84 | .Fn system | 82 | .Fn system |
| 85 | returns the termination status for a program that terminates with a call of | 83 | returns the termination status for a program that terminates with a call of |
| 86 | .Fn exit 127 . | 84 | .Fn exit 127 . |
| 87 | .Sh SEE ALSO | 85 | .Sh SEE ALSO |
| 88 | .Xr sh 1 , | 86 | .Xr sh 1 , |
| 89 | .Xr execve 2 , | 87 | .Xr execve 2 , |
| 90 | .Xr popen 3 , | 88 | .Xr waitpid 2 , |
| 91 | .Xr waitpid 3 , | 89 | .Xr popen 3 |
| 92 | .Sh STANDARDS | 90 | .Sh STANDARDS |
| 93 | The | 91 | The |
| 94 | .Fn system | 92 | .Fn system |
| 95 | function | 93 | function conforms to |
| 96 | conforms to | 94 | .St -ansiC |
| 97 | .St -ansiC | ||
| 98 | and | 95 | and |
| 99 | .St -1003.2-92 . | 96 | .St -p1003.2-92 . |
| 97 | .Sh CAVEATS | ||
| 98 | Never supply the | ||
| 99 | .Fn system | ||
| 100 | function with a command containing any part of an unsanitized user-supplied | ||
| 101 | string. | ||
| 102 | Shell meta-characters present will be honored by the | ||
| 103 | .Xr sh 1 | ||
| 104 | command interpreter. | ||
