cpl_spawn.h

00001 /**********************************************************************
00002  * $Id: cpl_spawn.h 27044 2014-03-16 23:41:27Z rouault $
00003  *
00004  * Project:  CPL - Common Portability Library
00005  * Purpose:  Implement CPLSystem().
00006  * Author:   Even Rouault, <even dot rouault at mines dash paris dot org>
00007  *
00008  **********************************************************************
00009  * Copyright (c) 2013, Even Rouault <even dot rouault at mines-paris dot org>
00010  *
00011  * Permission is hereby granted, free of charge, to any person obtaining a
00012  * copy of this software and associated documentation files (the "Software"),
00013  * to deal in the Software without restriction, including without limitation
00014  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00015  * and/or sell copies of the Software, and to permit persons to whom the
00016  * Software is furnished to do so, subject to the following conditions:
00017  * 
00018  * The above copyright notice and this permission notice shall be included
00019  * in all copies or substantial portions of the Software.
00020  * 
00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00022  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00024  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00026  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
00027  * DEALINGS IN THE SOFTWARE.
00028  ****************************************************************************/
00029 
00030 #ifndef CPL_SPAWN_H_INCLUDED
00031 #define CPL_SPAWN_H_INCLUDED
00032 
00033 #include "cpl_vsi.h"
00034 
00035 CPL_C_START
00036 
00037 /* -------------------------------------------------------------------- */
00038 /*      Spawn a process.                                                */
00039 /* -------------------------------------------------------------------- */
00040 
00041 int CPL_DLL CPLSpawn( const char * const papszArgv[], VSILFILE* fin, VSILFILE* fout,
00042                       int bDisplayErr );
00043 
00044 #ifdef WIN32
00045 #include <windows.h>
00046 typedef HANDLE CPL_FILE_HANDLE;
00047 #define CPL_FILE_INVALID_HANDLE NULL
00048 typedef DWORD  CPL_PID;
00049 #else
00050 #include <sys/types.h>
00051 typedef int    CPL_FILE_HANDLE;
00052 #define CPL_FILE_INVALID_HANDLE -1
00053 typedef pid_t  CPL_PID;
00054 #endif
00055 
00056 typedef struct _CPLSpawnedProcess CPLSpawnedProcess;
00057 
00058 CPLSpawnedProcess CPL_DLL* CPLSpawnAsync( int (*pfnMain)(CPL_FILE_HANDLE, CPL_FILE_HANDLE),
00059                                           const char * const papszArgv[],
00060                                           int bCreateInputPipe,
00061                                           int bCreateOutputPipe,
00062                                           int bCreateErrorPipe,
00063                                           char** papszOptions );
00064 CPL_PID CPL_DLL CPLSpawnAsyncGetChildProcessId(CPLSpawnedProcess* p);
00065 int CPL_DLL CPLSpawnAsyncFinish(CPLSpawnedProcess* p, int bWait, int bKill);
00066 CPL_FILE_HANDLE CPL_DLL CPLSpawnAsyncGetInputFileHandle(CPLSpawnedProcess* p);
00067 CPL_FILE_HANDLE CPL_DLL CPLSpawnAsyncGetOutputFileHandle(CPLSpawnedProcess* p);
00068 CPL_FILE_HANDLE CPL_DLL CPLSpawnAsyncGetErrorFileHandle(CPLSpawnedProcess* p);
00069 void CPL_DLL CPLSpawnAsyncCloseInputFileHandle(CPLSpawnedProcess* p);
00070 void CPL_DLL CPLSpawnAsyncCloseOutputFileHandle(CPLSpawnedProcess* p);
00071 void CPL_DLL CPLSpawnAsyncCloseErrorFileHandle(CPLSpawnedProcess* p);
00072 
00073 int CPL_DLL CPLPipeRead(CPL_FILE_HANDLE fin, void* data, int length);
00074 int CPL_DLL CPLPipeWrite(CPL_FILE_HANDLE fout, const void* data, int length);
00075 
00076 CPL_C_END
00077 
00078 #endif // CPL_SPAWN_H_INCLUDED
00079 

Generated for GDAL by doxygen 1.7.1.