UDK 3.2.7 C/C++ API Reference
osl/process.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*************************************************************************
00003  *
00004  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
00005  *
00006  * Copyright 2000, 2010 Oracle and/or its affiliates.
00007  *
00008  * OpenOffice.org - a multi-platform office productivity suite
00009  *
00010  * This file is part of OpenOffice.org.
00011  *
00012  * OpenOffice.org is free software: you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 3
00014  * only, as published by the Free Software Foundation.
00015  *
00016  * OpenOffice.org is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License version 3 for more details
00020  * (a copy is included in the LICENSE file that accompanied this code).
00021  *
00022  * You should have received a copy of the GNU Lesser General Public License
00023  * version 3 along with OpenOffice.org.  If not, see
00024  * <http://www.openoffice.org/license.html>
00025  * for a copy of the LGPLv3 License.
00026  *
00027  ************************************************************************/
00028 
00029 
00030 #ifndef _OSL_PROCESS_H_
00031 #define _OSL_PROCESS_H_
00032 
00033 #include <rtl/ustring.h>
00034 #include <rtl/textenc.h>
00035 #include <rtl/locale.h>
00036 
00037 #include <osl/time.h>
00038 #include <osl/file.h>
00039 #include <osl/pipe.h>
00040 #include <osl/socket.h>
00041 #include <osl/security.h>
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif
00046 
00047 
00048 typedef sal_Int32 oslProcessOption;
00049 #define     osl_Process_WAIT       0x0001    /* wait for completion */
00050 #define     osl_Process_SEARCHPATH 0x0002    /* search path for executable */
00051 #define     osl_Process_DETACHED   0x0004    /* run detached */
00052 #define     osl_Process_NORMAL     0x0000    /* run in normal window */
00053 #define     osl_Process_HIDDEN     0x0010    /* run hidden */
00054 #define     osl_Process_MINIMIZED  0x0020    /* run in minimized window */
00055 #define     osl_Process_MAXIMIZED  0x0040    /* run in maximized window */
00056 #define     osl_Process_FULLSCREEN 0x0080    /* run in fullscreen window */
00057 
00058 typedef sal_Int32 oslProcessData;
00059 
00060 /* defines for osl_getProcessInfo , can be OR'ed */
00061 #define     osl_Process_IDENTIFIER  0x0001   /* retrieves the process identifier   */
00062 #define     osl_Process_EXITCODE    0x0002   /* retrieves exit code of the process */
00063 #define     osl_Process_CPUTIMES    0x0004   /* retrieves used cpu time            */
00064 #define     osl_Process_HEAPUSAGE   0x0008   /* retrieves the used size of heap    */
00065 
00066 typedef sal_uInt32 oslProcessIdentifier;
00067 typedef sal_uInt32 oslProcessExitCode;
00068 
00069 typedef enum {
00070     osl_Process_E_None,                 /* no error */
00071     osl_Process_E_NotFound,             /* image not found */
00072     osl_Process_E_TimedOut,             /* timout occurred */
00073     osl_Process_E_NoPermission,         /* permission denied */
00074     osl_Process_E_Unknown,              /* unknown error */
00075     osl_Process_E_InvalidError,         /* unmapped error */
00076     osl_Process_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
00077 } oslProcessError;
00078 
00079 typedef enum {
00080     osl_Process_TypeNone,       /* no descriptor */
00081     osl_Process_TypeSocket,     /* socket */
00082     osl_Process_TypeFile,       /* file   */
00083     osl_Process_TypePipe,       /* pipe   */
00084     osl_Process_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
00085 } oslDescriptorType;
00086 
00087 typedef sal_Int32 oslDescriptorFlag;
00088 #define osl_Process_DFNONE       0x0000
00089 #define osl_Process_DFWAIT       0x0001
00090 
00091 #ifdef SAL_W32
00092 #   pragma pack(push, 8)
00093 #endif
00094 
00095 typedef struct {
00096     sal_uInt32              Size;
00097     oslProcessData          Fields;
00098     oslProcessIdentifier    Ident;
00099     oslProcessExitCode      Code;
00100     TimeValue               UserTime;
00101     TimeValue               SystemTime;
00102     sal_uInt32              HeapUsage;
00103 } oslProcessInfo;
00104 
00105 #if defined( SAL_W32)
00106 #   pragma pack(pop)
00107 #endif
00108 
00117 typedef void* oslProcess;
00118 
00179 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_executeProcess(
00180     rtl_uString* ustrImageName,
00181     rtl_uString* ustrArguments[],
00182     sal_uInt32  nArguments,
00183     oslProcessOption Options,
00184     oslSecurity Security,
00185     rtl_uString* ustrDirectory,
00186     rtl_uString* ustrEnvironments[],
00187     sal_uInt32 nEnvironmentVars,
00188     oslProcess* pProcess);
00189 
00190 
00265 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
00266     rtl_uString* strImageName,
00267     rtl_uString* ustrArguments[],
00268     sal_uInt32 nArguments,
00269     oslProcessOption Options,
00270     oslSecurity Security,
00271     rtl_uString* ustrDirectory,
00272     rtl_uString* ustrEnvironments[],
00273     sal_uInt32 nEnvironmentVars,
00274     oslProcess* pProcess,
00275     oslFileHandle* pChildInputWrite,
00276     oslFileHandle* pChildOutputRead,
00277     oslFileHandle* pChildErrorRead);
00278 
00286 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_terminateProcess(
00287         oslProcess Process);
00288 
00289 
00296 SAL_DLLPUBLIC oslProcess SAL_CALL osl_getProcess(
00297         oslProcessIdentifier Ident);
00298 
00299 
00303 SAL_DLLPUBLIC void SAL_CALL osl_freeProcessHandle(
00304         oslProcess Process);
00305 
00306 
00312 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_joinProcess(
00313         oslProcess Process);
00314 
00332 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_joinProcessWithTimeout(
00333         oslProcess Process, const TimeValue* pTimeout);
00334 
00350 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessInfo(
00351         oslProcess Process, oslProcessData Fields, oslProcessInfo* pInfo);
00352 
00358 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getExecutableFile(
00359         rtl_uString **strFile);
00360 
00365 SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_getCommandArgCount(void);
00366 
00373 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getCommandArg(
00374         sal_uInt32 nArg, rtl_uString **strCommandArg);
00375 
00389 SAL_DLLPUBLIC void SAL_CALL osl_setCommandArgs (int argc, char **argv);
00390 
00395 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getEnvironment(
00396         rtl_uString *strVar, rtl_uString **strValue);
00397 
00404 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setEnvironment(
00405         rtl_uString *strVar, rtl_uString *strValue);
00406 
00412 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_clearEnvironment(
00413         rtl_uString *strVar);
00414 
00421 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessWorkingDir(
00422         rtl_uString **pustrWorkingDir );
00423 
00433 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessLocale(
00434         rtl_Locale ** ppLocale );
00435 
00442 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setProcessLocale(
00443         rtl_Locale * pLocale );
00444 
00445 
00446 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_sendResourcePipe(
00447         oslPipe Pipe, oslSocket Socket );
00448 
00449 SAL_DLLPUBLIC oslSocket SAL_CALL osl_receiveResourcePipe(
00450         oslPipe Pipe );
00451 
00452 #ifdef __cplusplus
00453 }
00454 #endif
00455 
00456 #endif    /* _OSL_PROCESS_H_ */
00457 
00458 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines