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  * This file is part of the LibreOffice project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * This file incorporates work covered by the following license notice:
00010  *
00011  *   Licensed to the Apache Software Foundation (ASF) under one or more
00012  *   contributor license agreements. See the NOTICE file distributed
00013  *   with this work for additional information regarding copyright
00014  *   ownership. The ASF licenses this file to you under the Apache
00015  *   License, Version 2.0 (the "License"); you may not use this file
00016  *   except in compliance with the License. You may obtain a copy of
00017  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
00018  */
00019 
00020 
00021 #ifndef _OSL_PROCESS_H_
00022 #define _OSL_PROCESS_H_
00023 
00024 #include "sal/config.h"
00025 
00026 #include "osl/file.h"
00027 #include "osl/pipe.h"
00028 #include "osl/security.h"
00029 #include "osl/socket.h"
00030 #include "osl/time.h"
00031 #include "rtl/locale.h"
00032 #include "rtl/textenc.h"
00033 #include "rtl/ustring.h"
00034 #include "sal/saldllapi.h"
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 
00041 typedef sal_Int32 oslProcessOption;
00042 #define     osl_Process_WAIT       0x0001    /* wait for completion */
00043 #define     osl_Process_SEARCHPATH 0x0002    /* search path for executable */
00044 #define     osl_Process_DETACHED   0x0004    /* run detached */
00045 #define     osl_Process_NORMAL     0x0000    /* run in normal window */
00046 #define     osl_Process_HIDDEN     0x0010    /* run hidden */
00047 #define     osl_Process_MINIMIZED  0x0020    /* run in minimized window */
00048 #define     osl_Process_MAXIMIZED  0x0040    /* run in maximized window */
00049 #define     osl_Process_FULLSCREEN 0x0080    /* run in fullscreen window */
00050 
00051 typedef sal_Int32 oslProcessData;
00052 
00053 /* defines for osl_getProcessInfo , can be OR'ed */
00054 #define     osl_Process_IDENTIFIER  0x0001   /* retrieves the process identifier   */
00055 #define     osl_Process_EXITCODE    0x0002   /* retrieves exit code of the process */
00056 #define     osl_Process_CPUTIMES    0x0004   /* retrieves used cpu time            */
00057 #define     osl_Process_HEAPUSAGE   0x0008   /* retrieves the used size of heap    */
00058 
00059 typedef sal_uInt32 oslProcessIdentifier;
00060 typedef sal_uInt32 oslProcessExitCode;
00061 
00062 typedef enum {
00063     osl_Process_E_None,                 /* no error */
00064     osl_Process_E_NotFound,             /* image not found */
00065     osl_Process_E_TimedOut,             /* timout occurred */
00066     osl_Process_E_NoPermission,         /* permission denied */
00067     osl_Process_E_Unknown,              /* unknown error */
00068     osl_Process_E_InvalidError,         /* unmapped error */
00069     osl_Process_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
00070 } oslProcessError;
00071 
00072 typedef enum {
00073     osl_Process_TypeNone,       /* no descriptor */
00074     osl_Process_TypeSocket,     /* socket */
00075     osl_Process_TypeFile,       /* file   */
00076     osl_Process_TypePipe,       /* pipe   */
00077     osl_Process_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
00078 } oslDescriptorType;
00079 
00080 typedef sal_Int32 oslDescriptorFlag;
00081 #define osl_Process_DFNONE       0x0000
00082 #define osl_Process_DFWAIT       0x0001
00083 
00084 #ifdef SAL_W32
00085 #   pragma pack(push, 8)
00086 #endif
00087 
00088 typedef struct {
00089     sal_uInt32              Size;
00090     oslProcessData          Fields;
00091     oslProcessIdentifier    Ident;
00092     oslProcessExitCode      Code;
00093     TimeValue               UserTime;
00094     TimeValue               SystemTime;
00095     sal_uInt32              HeapUsage;
00096 } oslProcessInfo;
00097 
00098 #if defined( SAL_W32)
00099 #   pragma pack(pop)
00100 #endif
00101 
00110 typedef void* oslProcess;
00111 
00172 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_executeProcess(
00173     rtl_uString* ustrImageName,
00174     rtl_uString* ustrArguments[],
00175     sal_uInt32  nArguments,
00176     oslProcessOption Options,
00177     oslSecurity Security,
00178     rtl_uString* ustrDirectory,
00179     rtl_uString* ustrEnvironments[],
00180     sal_uInt32 nEnvironmentVars,
00181     oslProcess* pProcess);
00182 
00183 
00258 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
00259     rtl_uString* strImageName,
00260     rtl_uString* ustrArguments[],
00261     sal_uInt32 nArguments,
00262     oslProcessOption Options,
00263     oslSecurity Security,
00264     rtl_uString* ustrDirectory,
00265     rtl_uString* ustrEnvironments[],
00266     sal_uInt32 nEnvironmentVars,
00267     oslProcess* pProcess,
00268     oslFileHandle* pChildInputWrite,
00269     oslFileHandle* pChildOutputRead,
00270     oslFileHandle* pChildErrorRead);
00271 
00279 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_terminateProcess(
00280         oslProcess Process);
00281 
00282 
00289 SAL_DLLPUBLIC oslProcess SAL_CALL osl_getProcess(
00290         oslProcessIdentifier Ident);
00291 
00292 
00296 SAL_DLLPUBLIC void SAL_CALL osl_freeProcessHandle(
00297         oslProcess Process);
00298 
00299 
00305 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_joinProcess(
00306         oslProcess Process);
00307 
00325 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_joinProcessWithTimeout(
00326         oslProcess Process, const TimeValue* pTimeout);
00327 
00343 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessInfo(
00344         oslProcess Process, oslProcessData Fields, oslProcessInfo* pInfo);
00345 
00351 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getExecutableFile(
00352         rtl_uString **strFile);
00353 
00358 SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_getCommandArgCount(void);
00359 
00366 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getCommandArg(
00367         sal_uInt32 nArg, rtl_uString **strCommandArg);
00368 
00382 SAL_DLLPUBLIC void SAL_CALL osl_setCommandArgs (int argc, char **argv);
00383 
00388 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getEnvironment(
00389         rtl_uString *strVar, rtl_uString **strValue);
00390 
00397 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setEnvironment(
00398         rtl_uString *strVar, rtl_uString *strValue);
00399 
00405 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_clearEnvironment(
00406         rtl_uString *strVar);
00407 
00414 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessWorkingDir(
00415         rtl_uString **pustrWorkingDir );
00416 
00426 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessLocale(
00427         rtl_Locale ** ppLocale );
00428 
00435 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setProcessLocale(
00436         rtl_Locale * pLocale );
00437 
00438 
00439 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_sendResourcePipe(
00440         oslPipe Pipe, oslSocket Socket );
00441 
00442 SAL_DLLPUBLIC oslSocket SAL_CALL osl_receiveResourcePipe(
00443         oslPipe Pipe );
00444 
00445 #ifdef __cplusplus
00446 }
00447 #endif
00448 
00449 #endif    /* _OSL_PROCESS_H_ */
00450 
00451 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines