GDAL
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
41int CPL_DLL CPLSpawn( const char * const papszArgv[], VSILFILE* fin, VSILFILE* fout,
42 int bDisplayErr );
43
44#ifdef WIN32
45#include <windows.h>
46typedef HANDLE CPL_FILE_HANDLE;
47#define CPL_FILE_INVALID_HANDLE CPL_NULLPTR
48typedef DWORD CPL_PID;
49#else
50#include <sys/types.h>
51typedef int CPL_FILE_HANDLE;
52#define CPL_FILE_INVALID_HANDLE -1
53typedef pid_t CPL_PID;
54#endif
55
56typedef struct _CPLSpawnedProcess CPLSpawnedProcess;
57
58CPLSpawnedProcess 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 );
64CPL_PID CPL_DLL CPLSpawnAsyncGetChildProcessId(CPLSpawnedProcess* p);
65int CPL_DLL CPLSpawnAsyncFinish(CPLSpawnedProcess* p, int bWait, int bKill);
66CPL_FILE_HANDLE CPL_DLL CPLSpawnAsyncGetInputFileHandle(CPLSpawnedProcess* p);
67CPL_FILE_HANDLE CPL_DLL CPLSpawnAsyncGetOutputFileHandle(CPLSpawnedProcess* p);
68CPL_FILE_HANDLE CPL_DLL CPLSpawnAsyncGetErrorFileHandle(CPLSpawnedProcess* p);
69void CPL_DLL CPLSpawnAsyncCloseInputFileHandle(CPLSpawnedProcess* p);
70void CPL_DLL CPLSpawnAsyncCloseOutputFileHandle(CPLSpawnedProcess* p);
71void CPL_DLL CPLSpawnAsyncCloseErrorFileHandle(CPLSpawnedProcess* p);
72
73int CPL_DLL CPLPipeRead(CPL_FILE_HANDLE fin, void* data, int length);
74int CPL_DLL CPLPipeWrite(CPL_FILE_HANDLE fout, const void* data, int length);
75
77
78#endif // CPL_SPAWN_H_INCLUDED
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:339
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:337
Standard C Covers.
FILE VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition: cpl_vsi.h:156

Generated for GDAL by doxygen 1.9.4.