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