1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/nsprpub/pr/include/prproces.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,86 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef prproces_h___ 1.10 +#define prproces_h___ 1.11 + 1.12 +#include "prtypes.h" 1.13 +#include "prio.h" 1.14 + 1.15 +PR_BEGIN_EXTERN_C 1.16 + 1.17 +/************************************************************************/ 1.18 +/*****************************PROCESS OPERATIONS*************************/ 1.19 +/************************************************************************/ 1.20 + 1.21 +typedef struct PRProcess PRProcess; 1.22 +typedef struct PRProcessAttr PRProcessAttr; 1.23 + 1.24 +NSPR_API(PRProcessAttr *) PR_NewProcessAttr(void); 1.25 + 1.26 +NSPR_API(void) PR_ResetProcessAttr(PRProcessAttr *attr); 1.27 + 1.28 +NSPR_API(void) PR_DestroyProcessAttr(PRProcessAttr *attr); 1.29 + 1.30 +NSPR_API(void) PR_ProcessAttrSetStdioRedirect( 1.31 + PRProcessAttr *attr, 1.32 + PRSpecialFD stdioFd, 1.33 + PRFileDesc *redirectFd 1.34 +); 1.35 + 1.36 +/* 1.37 + * OBSOLETE -- use PR_ProcessAttrSetStdioRedirect instead. 1.38 + */ 1.39 +NSPR_API(void) PR_SetStdioRedirect( 1.40 + PRProcessAttr *attr, 1.41 + PRSpecialFD stdioFd, 1.42 + PRFileDesc *redirectFd 1.43 +); 1.44 + 1.45 +NSPR_API(PRStatus) PR_ProcessAttrSetCurrentDirectory( 1.46 + PRProcessAttr *attr, 1.47 + const char *dir 1.48 +); 1.49 + 1.50 +NSPR_API(PRStatus) PR_ProcessAttrSetInheritableFD( 1.51 + PRProcessAttr *attr, 1.52 + PRFileDesc *fd, 1.53 + const char *name 1.54 +); 1.55 + 1.56 +/* 1.57 +** Create a new process 1.58 +** 1.59 +** Create a new process executing the file specified as 'path' and with 1.60 +** the supplied arguments and environment. 1.61 +** 1.62 +** This function may fail because of illegal access (permissions), 1.63 +** invalid arguments or insufficient resources. 1.64 +** 1.65 +** A process may be created such that the creator can later synchronize its 1.66 +** termination using PR_WaitProcess(). 1.67 +*/ 1.68 + 1.69 +NSPR_API(PRProcess*) PR_CreateProcess( 1.70 + const char *path, 1.71 + char *const *argv, 1.72 + char *const *envp, 1.73 + const PRProcessAttr *attr); 1.74 + 1.75 +NSPR_API(PRStatus) PR_CreateProcessDetached( 1.76 + const char *path, 1.77 + char *const *argv, 1.78 + char *const *envp, 1.79 + const PRProcessAttr *attr); 1.80 + 1.81 +NSPR_API(PRStatus) PR_DetachProcess(PRProcess *process); 1.82 + 1.83 +NSPR_API(PRStatus) PR_WaitProcess(PRProcess *process, PRInt32 *exitCode); 1.84 + 1.85 +NSPR_API(PRStatus) PR_KillProcess(PRProcess *process); 1.86 + 1.87 +PR_END_EXTERN_C 1.88 + 1.89 +#endif /* prproces_h___ */