1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
5 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
6 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | * http://www.mozilla.org/MPL/
|
---|
9 | *
|
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
12 | * for the specific language governing rights and limitations under the
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is the Netscape Portable Runtime (NSPR).
|
---|
16 | *
|
---|
17 | * The Initial Developer of the Original Code is
|
---|
18 | * Netscape Communications Corporation.
|
---|
19 | * Portions created by the Initial Developer are Copyright (C) 1998-2000
|
---|
20 | * the Initial Developer. All Rights Reserved.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | *
|
---|
24 | * Alternatively, the contents of this file may be used under the terms of
|
---|
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
|
---|
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
28 | * of those above. If you wish to allow use of your version of this file only
|
---|
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
30 | * use your version of this file under the terms of the MPL, indicate your
|
---|
31 | * decision by deleting the provisions above and replace them with the notice
|
---|
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
33 | * the provisions above, a recipient may use your version of this file under
|
---|
34 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
35 | *
|
---|
36 | * ***** END LICENSE BLOCK ***** */
|
---|
37 |
|
---|
38 | #ifndef prproces_h___
|
---|
39 | #define prproces_h___
|
---|
40 |
|
---|
41 | #include "prtypes.h"
|
---|
42 | #include "prio.h"
|
---|
43 |
|
---|
44 | #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
|
---|
45 | #define PR_CreateProcessDetached VBoxNsprPR_CreateProcessDetached
|
---|
46 | #define PR_ProcessAttrSetInheritableFD VBoxNsprPR_ProcessAttrSetInheritableFD
|
---|
47 | #define PR_DestroyProcessAttr VBoxNsprPR_DestroyProcessAttr
|
---|
48 | #define PR_NewProcessAttr VBoxNsprPR_NewProcessAttr
|
---|
49 | #define PR_ResetProcessAttr VBoxNsprPR_ResetProcessAttr
|
---|
50 | #define PR_ProcessAttrSetStdioRedirect VBoxNsprPR_ProcessAttrSetStdioRedirect
|
---|
51 | #define PR_SetStdioRedirect VBoxNsprPR_SetStdioRedirect
|
---|
52 | #define PR_ProcessAttrSetCurrentDirectory VBoxNsprPR_ProcessAttrSetCurrentDirectory
|
---|
53 | #define PR_CreateProcess VBoxNsprPR_CreateProcess
|
---|
54 | #define PR_DetachProcess VBoxNsprPR_DetachProcess
|
---|
55 | #define PR_WaitProcess VBoxNsprPR_WaitProcess
|
---|
56 | #define PR_KillProcess VBoxNsprPR_KillProcess
|
---|
57 | #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
|
---|
58 |
|
---|
59 | PR_BEGIN_EXTERN_C
|
---|
60 |
|
---|
61 | /************************************************************************/
|
---|
62 | /*****************************PROCESS OPERATIONS*************************/
|
---|
63 | /************************************************************************/
|
---|
64 |
|
---|
65 | typedef struct PRProcess PRProcess;
|
---|
66 | typedef struct PRProcessAttr PRProcessAttr;
|
---|
67 |
|
---|
68 | NSPR_API(PRProcessAttr *) PR_NewProcessAttr(void);
|
---|
69 |
|
---|
70 | NSPR_API(void) PR_ResetProcessAttr(PRProcessAttr *attr);
|
---|
71 |
|
---|
72 | NSPR_API(void) PR_DestroyProcessAttr(PRProcessAttr *attr);
|
---|
73 |
|
---|
74 | NSPR_API(void) PR_ProcessAttrSetStdioRedirect(
|
---|
75 | PRProcessAttr *attr,
|
---|
76 | PRSpecialFD stdioFd,
|
---|
77 | PRFileDesc *redirectFd
|
---|
78 | );
|
---|
79 |
|
---|
80 | /*
|
---|
81 | * OBSOLETE -- use PR_ProcessAttrSetStdioRedirect instead.
|
---|
82 | */
|
---|
83 | NSPR_API(void) PR_SetStdioRedirect(
|
---|
84 | PRProcessAttr *attr,
|
---|
85 | PRSpecialFD stdioFd,
|
---|
86 | PRFileDesc *redirectFd
|
---|
87 | );
|
---|
88 |
|
---|
89 | NSPR_API(PRStatus) PR_ProcessAttrSetCurrentDirectory(
|
---|
90 | PRProcessAttr *attr,
|
---|
91 | const char *dir
|
---|
92 | );
|
---|
93 |
|
---|
94 | NSPR_API(PRStatus) PR_ProcessAttrSetInheritableFD(
|
---|
95 | PRProcessAttr *attr,
|
---|
96 | PRFileDesc *fd,
|
---|
97 | const char *name
|
---|
98 | );
|
---|
99 |
|
---|
100 | /*
|
---|
101 | ** Create a new process
|
---|
102 | **
|
---|
103 | ** Create a new process executing the file specified as 'path' and with
|
---|
104 | ** the supplied arguments and environment.
|
---|
105 | **
|
---|
106 | ** This function may fail because of illegal access (permissions),
|
---|
107 | ** invalid arguments or insufficient resources.
|
---|
108 | **
|
---|
109 | ** A process may be created such that the creator can later synchronize its
|
---|
110 | ** termination using PR_WaitProcess().
|
---|
111 | */
|
---|
112 |
|
---|
113 | NSPR_API(PRProcess*) PR_CreateProcess(
|
---|
114 | const char *path,
|
---|
115 | char *const *argv,
|
---|
116 | char *const *envp,
|
---|
117 | const PRProcessAttr *attr);
|
---|
118 |
|
---|
119 | NSPR_API(PRStatus) PR_CreateProcessDetached(
|
---|
120 | const char *path,
|
---|
121 | char *const *argv,
|
---|
122 | char *const *envp,
|
---|
123 | const PRProcessAttr *attr);
|
---|
124 |
|
---|
125 | NSPR_API(PRStatus) PR_DetachProcess(PRProcess *process);
|
---|
126 |
|
---|
127 | NSPR_API(PRStatus) PR_WaitProcess(PRProcess *process, PRInt32 *exitCode);
|
---|
128 |
|
---|
129 | NSPR_API(PRStatus) PR_KillProcess(PRProcess *process);
|
---|
130 |
|
---|
131 | PR_END_EXTERN_C
|
---|
132 |
|
---|
133 | #endif /* prproces_h___ */
|
---|