michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef prproces_h___ michael@0: #define prproces_h___ michael@0: michael@0: #include "prtypes.h" michael@0: #include "prio.h" michael@0: michael@0: PR_BEGIN_EXTERN_C michael@0: michael@0: /************************************************************************/ michael@0: /*****************************PROCESS OPERATIONS*************************/ michael@0: /************************************************************************/ michael@0: michael@0: typedef struct PRProcess PRProcess; michael@0: typedef struct PRProcessAttr PRProcessAttr; michael@0: michael@0: NSPR_API(PRProcessAttr *) PR_NewProcessAttr(void); michael@0: michael@0: NSPR_API(void) PR_ResetProcessAttr(PRProcessAttr *attr); michael@0: michael@0: NSPR_API(void) PR_DestroyProcessAttr(PRProcessAttr *attr); michael@0: michael@0: NSPR_API(void) PR_ProcessAttrSetStdioRedirect( michael@0: PRProcessAttr *attr, michael@0: PRSpecialFD stdioFd, michael@0: PRFileDesc *redirectFd michael@0: ); michael@0: michael@0: /* michael@0: * OBSOLETE -- use PR_ProcessAttrSetStdioRedirect instead. michael@0: */ michael@0: NSPR_API(void) PR_SetStdioRedirect( michael@0: PRProcessAttr *attr, michael@0: PRSpecialFD stdioFd, michael@0: PRFileDesc *redirectFd michael@0: ); michael@0: michael@0: NSPR_API(PRStatus) PR_ProcessAttrSetCurrentDirectory( michael@0: PRProcessAttr *attr, michael@0: const char *dir michael@0: ); michael@0: michael@0: NSPR_API(PRStatus) PR_ProcessAttrSetInheritableFD( michael@0: PRProcessAttr *attr, michael@0: PRFileDesc *fd, michael@0: const char *name michael@0: ); michael@0: michael@0: /* michael@0: ** Create a new process michael@0: ** michael@0: ** Create a new process executing the file specified as 'path' and with michael@0: ** the supplied arguments and environment. michael@0: ** michael@0: ** This function may fail because of illegal access (permissions), michael@0: ** invalid arguments or insufficient resources. michael@0: ** michael@0: ** A process may be created such that the creator can later synchronize its michael@0: ** termination using PR_WaitProcess(). michael@0: */ michael@0: michael@0: NSPR_API(PRProcess*) PR_CreateProcess( michael@0: const char *path, michael@0: char *const *argv, michael@0: char *const *envp, michael@0: const PRProcessAttr *attr); michael@0: michael@0: NSPR_API(PRStatus) PR_CreateProcessDetached( michael@0: const char *path, michael@0: char *const *argv, michael@0: char *const *envp, michael@0: const PRProcessAttr *attr); michael@0: michael@0: NSPR_API(PRStatus) PR_DetachProcess(PRProcess *process); michael@0: michael@0: NSPR_API(PRStatus) PR_WaitProcess(PRProcess *process, PRInt32 *exitCode); michael@0: michael@0: NSPR_API(PRStatus) PR_KillProcess(PRProcess *process); michael@0: michael@0: PR_END_EXTERN_C michael@0: michael@0: #endif /* prproces_h___ */