Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef prproces_h___
7 #define prproces_h___
9 #include "prtypes.h"
10 #include "prio.h"
12 PR_BEGIN_EXTERN_C
14 /************************************************************************/
15 /*****************************PROCESS OPERATIONS*************************/
16 /************************************************************************/
18 typedef struct PRProcess PRProcess;
19 typedef struct PRProcessAttr PRProcessAttr;
21 NSPR_API(PRProcessAttr *) PR_NewProcessAttr(void);
23 NSPR_API(void) PR_ResetProcessAttr(PRProcessAttr *attr);
25 NSPR_API(void) PR_DestroyProcessAttr(PRProcessAttr *attr);
27 NSPR_API(void) PR_ProcessAttrSetStdioRedirect(
28 PRProcessAttr *attr,
29 PRSpecialFD stdioFd,
30 PRFileDesc *redirectFd
31 );
33 /*
34 * OBSOLETE -- use PR_ProcessAttrSetStdioRedirect instead.
35 */
36 NSPR_API(void) PR_SetStdioRedirect(
37 PRProcessAttr *attr,
38 PRSpecialFD stdioFd,
39 PRFileDesc *redirectFd
40 );
42 NSPR_API(PRStatus) PR_ProcessAttrSetCurrentDirectory(
43 PRProcessAttr *attr,
44 const char *dir
45 );
47 NSPR_API(PRStatus) PR_ProcessAttrSetInheritableFD(
48 PRProcessAttr *attr,
49 PRFileDesc *fd,
50 const char *name
51 );
53 /*
54 ** Create a new process
55 **
56 ** Create a new process executing the file specified as 'path' and with
57 ** the supplied arguments and environment.
58 **
59 ** This function may fail because of illegal access (permissions),
60 ** invalid arguments or insufficient resources.
61 **
62 ** A process may be created such that the creator can later synchronize its
63 ** termination using PR_WaitProcess().
64 */
66 NSPR_API(PRProcess*) PR_CreateProcess(
67 const char *path,
68 char *const *argv,
69 char *const *envp,
70 const PRProcessAttr *attr);
72 NSPR_API(PRStatus) PR_CreateProcessDetached(
73 const char *path,
74 char *const *argv,
75 char *const *envp,
76 const PRProcessAttr *attr);
78 NSPR_API(PRStatus) PR_DetachProcess(PRProcess *process);
80 NSPR_API(PRStatus) PR_WaitProcess(PRProcess *process, PRInt32 *exitCode);
82 NSPR_API(PRStatus) PR_KillProcess(PRProcess *process);
84 PR_END_EXTERN_C
86 #endif /* prproces_h___ */