File: Ns_Exec.3

package info (click to toggle)
aolserver4 4.0.10-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 10,980 kB
  • ctags: 14,068
  • sloc: ansic: 39,138; tcl: 3,233; sh: 2,703; makefile: 255; php: 13
file content (134 lines) | stat: -rw-r--r-- 4,351 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

'\"
'\" The contents of this file are subject to the AOLserver Public License
'\" Version 1.1 (the "License"); you may not use this file except in
'\" compliance with the License. You may obtain a copy of the License at
'\" http://aolserver.com/.
'\"
'\" Software distributed under the License is distributed on an "AS IS"
'\" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
'\" the License for the specific language governing rights and limitations
'\" under the License.
'\"
'\" The Original Code is AOLserver Code and related documentation
'\" distributed by AOL.
'\" 
'\" The Initial Developer of the Original Code is America Online,
'\" Inc. Portions created by AOL are Copyright (C) 1999 America Online,
'\" Inc. All Rights Reserved.
'\"
'\" Alternatively, the contents of this file may be used under the terms
'\" of the GNU General Public License (the "GPL"), in which case the
'\" provisions of GPL are applicable instead of those above.  If you wish
'\" to allow use of your version of this file only under the terms of the
'\" GPL and not to allow others to use your version of this file under the
'\" License, indicate your decision by deleting the provisions above and
'\" replace them with the notice and other provisions required by the GPL.
'\" If you do not delete the provisions above, a recipient may use your
'\" version of this file under either the License or the GPL.
'\" 
'\"
'\" $Header: /cvsroot/aolserver/aolserver/doc/Ns_Exec.3,v 1.5 2003/04/10 22:00:40 shmooved Exp $
'\"
'\" 
.so man.macros

.TH Ns_Exec 3 4.0 AOLserver "AOLserver Library Procedures"
.BS
'\" Note:  do not modify the .SH NAME line immediately below!
.SH NAME
Ns_ExecArgblk, Ns_ExecArgv, Ns_ExecProc, Ns_ExecProcess, Ns_Fork, Ns_GetEnviron, 
Ns_WaitForProcess, Ns_WaitProcess, ns_fork \- External process execution
.SH SYNOPSIS
.nf
\fB#include "ns.h"\fR
.sp
int
\fBNs_ExecArgblk\fR(\fIchar *exec, char *dir, int fdin, int fdout,
              char *args, Ns_Set *env\fR)
.sp
int
\fBNs_ExecArgv\fR(\fIchar *exec, char *dir, int fdin, int fdout, 
            char **argv, Ns_Set *env\fR)
.sp
int
\fBNs_ExecProc\fR(\fIchar *exec, char **argv\fR)
.sp
int
\fBNs_ExecProcess\fR(\fIchar *exec, char *dir, int fdin, int fdout,
			char *args, Ns_Set *env\fR)
.sp
int
\fBNs_Fork\fR(\fIvoid\fR)
.sp
char
\fB**Ns_GetEnviron\fR(\fIvoid\fR)
.sp
int
\fBNs_WaitForProcess\fR(\fIint pid, int *statusPtr\fR)
.sp
int
\fBNs_WaitProcess\fR(\fIint pid\fR)
.sp
int
\fBns_fork\fR(\fIvoid\fR)
.BE

.SH DESCRIPTION
.PP
These functions handle fork and exec operations. See files:
nsd/exec.c, nsd/tclenv.c and nsthread/fork.c.
.TP
\fBNs_ExecArgblk\fR(\fIexec, dir, fdin, fdout, args, env\fR)

Executes a command in a child process. Return process id of 
child process exec\'ing the command or \-1 on failure. Provides extended
error checking and error messages.
.TP
\fBNs_ExecArgv\fR(\fIexec, dir, fdin, fdout, argv, env\fR)

Execute a command in a child process using fork(2) and execve(2),
returns the process id of child process exec\'ing the command or
\-1 on failure. The child sends an extended error message to the
parent.
.TP
\fBNs_ExecProc\fR(\fIexec, argv\fR)

Executes a command in a child process. Returns the process id
of the child process exec\'ing the command or \-1 on failure. 
Simplifies call to Ns_ExecArgv.
.TP
\fBNs_ExecProcess\fR(\fIexec, dir, fdin, fdout, args, env\fR)

Executes a command in a child process. Returns the process id
of the child process exec\'ing the command or \-1 on failure. 
Calls Ns_ExecArgblk with same arguments.
.TP
\fBNs_Fork\fR(\fI\fR)
Posix style fork(), using fork1() on Solaris if needed. See
fork\(2\) man page. Calls ns_fork.
.TP
\fBNs_GetEnviron\fR(\fI\fR)

Returns pointer to the environment vector.
.TP
\fBNs_WaitForProcess\fR(\fIpid, statusPtr\fR)

Wait for child process. Returns NS_OK on success, or 
NS_ERROR on failure. *statusPtr is set to the exit 
code of the child process.
.TP
\fBNs_WaitProcess\fR(\fIpid\fR)

Wait for child process. Calls Ns_WaitForProcess with NULL
statusPtr. Returns NS_OK on success, or NS_ERROR on failure.
.TP
\fBns_fork\fR(\fI\fR)

Posix style fork(), using fork1() on Solaris if needed.

.SH "SEE ALSO"
nsd(1), info(n)

.SH KEYWORDS