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