OGR
cpl_spawn.h
1 /**********************************************************************
2  * $Id: cpl_spawn.h f5361e0be8e2ae819dde996e6c6aa5985b8fefec 2018-04-02 15:11:21 +0200 Even Rouault $
3  *
4  * Project: CPL - Common Portability Library
5  * Purpose: Implement CPLSystem().
6  * Author: Even Rouault, <even dot rouault at mines dash paris dot org>
7  *
8  **********************************************************************
9  * Copyright (c) 2013, Even Rouault <even dot rouault at mines-paris dot org>
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  ****************************************************************************/
29 
30 #ifndef CPL_SPAWN_H_INCLUDED
31 #define CPL_SPAWN_H_INCLUDED
32 
33 #include "cpl_vsi.h"
34 
36 
37 /* -------------------------------------------------------------------- */
38 /* Spawn a process. */
39 /* -------------------------------------------------------------------- */
40 
41 int CPL_DLL CPLSpawn( const char * const papszArgv[], VSILFILE* fin, VSILFILE* fout,
42  int bDisplayErr );
43 
44 #ifdef WIN32
45 #include <windows.h>
46 typedef HANDLE CPL_FILE_HANDLE;
47 #define CPL_FILE_INVALID_HANDLE CPL_NULLPTR
48 typedef DWORD CPL_PID;
49 #else
50 #include <sys/types.h>
51 typedef int CPL_FILE_HANDLE;
52 #define CPL_FILE_INVALID_HANDLE -1
53 typedef pid_t CPL_PID;
54 #endif
55 
57 
58 CPLSpawnedProcess CPL_DLL* CPLSpawnAsync( int (*pfnMain)(CPL_FILE_HANDLE, CPL_FILE_HANDLE),
59  const char * const papszArgv[],
60  int bCreateInputPipe,
61  int bCreateOutputPipe,
62  int bCreateErrorPipe,
63  char** papszOptions );
64 CPL_PID CPL_DLL CPLSpawnAsyncGetChildProcessId(CPLSpawnedProcess* p);
65 int CPL_DLL CPLSpawnAsyncFinish(CPLSpawnedProcess* p, int bWait, int bKill);
66 CPL_FILE_HANDLE CPL_DLL CPLSpawnAsyncGetInputFileHandle(CPLSpawnedProcess* p);
67 CPL_FILE_HANDLE CPL_DLL CPLSpawnAsyncGetOutputFileHandle(CPLSpawnedProcess* p);
68 CPL_FILE_HANDLE CPL_DLL CPLSpawnAsyncGetErrorFileHandle(CPLSpawnedProcess* p);
69 void CPL_DLL CPLSpawnAsyncCloseInputFileHandle(CPLSpawnedProcess* p);
70 void CPL_DLL CPLSpawnAsyncCloseOutputFileHandle(CPLSpawnedProcess* p);
71 void CPL_DLL CPLSpawnAsyncCloseErrorFileHandle(CPLSpawnedProcess* p);
72 
73 int CPL_DLL CPLPipeRead(CPL_FILE_HANDLE fin, void* data, int length);
74 int CPL_DLL CPLPipeWrite(CPL_FILE_HANDLE fout, const void* data, int length);
75 
77 
78 #endif // CPL_SPAWN_H_INCLUDED
GByte
unsigned char GByte
Definition: cpl_port.h:215
_CPLSpawnedProcess
Definition: cpl_spawn.cpp:561
VSIGetMemFileBuffer
GByte * VSIGetMemFileBuffer(const char *pszFilename, vsi_l_offset *pnDataLength, int bUnlinkAndSeize)
Fetch buffer underlying memory file.
Definition: cpl_vsi_mem.cpp:959
VSIFReadL
size_t VSIFReadL(void *, size_t, size_t, VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
Read bytes from file.
Definition: cpl_vsil.cpp:1690
cpl_error.h
CPLString::Printf
CPLSTRING_METHOD_DLL CPLString & Printf(const char *pszFormat,...)
Definition: cplstring.cpp:59
cpl_vsi.h
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:329
VSIFWriteL
size_t VSIFWriteL(const void *, size_t, size_t, VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
Write bytes to file.
Definition: cpl_vsil.cpp:1804
CPL_FRMT_GIB
#define CPL_FRMT_GIB
Definition: cpl_port.h:316
VSIFCloseL
int VSIFCloseL(VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
Close file.
Definition: cpl_vsil.cpp:1472
CPL_C_START
#define CPL_C_START
Definition: cpl_port.h:337
CPL_C_END
#define CPL_C_END
Definition: cpl_port.h:339
CPLMalloc
void * CPLMalloc(size_t)
Definition: cpl_conv.cpp:168
cpl_conv.h
cpl_string.h
CPLSPrintf
const char * CPLSPrintf(const char *fmt,...)
Definition: cpl_string.cpp:977
CPLError
void CPLError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt,...)
Definition: cpl_error.cpp:308
vsi_l_offset
GUIntBig vsi_l_offset
Definition: cpl_vsi.h:140
CSLDuplicate
char ** CSLDuplicate(CSLConstList papszStrList)
Definition: cpl_string.cpp:228
CSLDestroy
void CSLDestroy(char **papszStrList)
Definition: cpl_string.cpp:200
CPL_UNUSED
#define CPL_UNUSED
Definition: cpl_port.h:948
cpl_port.h
VSIFOpenL
VSILFILE * VSIFOpenL(const char *, const char *)
Open file.
Definition: cpl_vsil.cpp:997
CPLStrdup
char * CPLStrdup(const char *)
Definition: cpl_conv.cpp:293
CPLFree
#define CPLFree
Definition: cpl_conv.h:81
VSILFILE
FILE VSILFILE
Definition: cpl_vsi.h:156
CPLE_AppDefined
#define CPLE_AppDefined
Definition: cpl_error.h:99

Generated for GDAL by doxygen 1.8.17.