LibreOffice: osl/process.h Source File

LibreOffice LibreOffice 7.0 SDK C/C++ API Reference

process.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21 #ifndef INCLUDED_OSL_PROCESS_H
22 #define INCLUDED_OSL_PROCESS_H
23
24 #include "sal/config.h"
25
26 #include "osl/file.h"
27 #include "osl/security.h"
28 #include "osl/time.h"
29 #include "rtl/locale.h"
30 #include "rtl/ustring.h"
31 #include "sal/saldllapi.h"
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37
38 typedef sal_Int32 oslProcessOption;
39 #define osl_Process_WAIT 0x0001 /* wait for completion */
40 #define osl_Process_SEARCHPATH 0x0002 /* search path for executable */
41 #define osl_Process_DETACHED 0x0004 /* run detached */
42 #define osl_Process_NORMAL 0x0000 /* run in normal window */
43 #define osl_Process_HIDDEN 0x0010 /* run hidden */
44 #define osl_Process_MINIMIZED 0x0020 /* run in minimized window */
45 #define osl_Process_MAXIMIZED 0x0040 /* run in maximized window */
46 #define osl_Process_FULLSCREEN 0x0080 /* run in fullscreen window */
47
48 typedef sal_Int32 oslProcessData;
49
50 /* defines for osl_getProcessInfo , can be OR'ed */
51 #define osl_Process_IDENTIFIER 0x0001 /* retrieves the process identifier */
52 #define osl_Process_EXITCODE 0x0002 /* retrieves exit code of the process */
53 #define osl_Process_CPUTIMES 0x0004 /* retrieves used cpu time */
54 #define osl_Process_HEAPUSAGE 0x0008 /* retrieves the used size of heap */
55
56 typedef sal_uInt32 oslProcessIdentifier;
57 typedef sal_uInt32 oslProcessExitCode;
58
59 typedef enum {
60 osl_Process_E_None, /* no error */
61 osl_Process_E_NotFound, /* image not found */
62 osl_Process_E_TimedOut, /* timeout occurred */
63 osl_Process_E_NoPermission, /* permission denied */
64 osl_Process_E_Unknown, /* unknown error */
65 osl_Process_E_InvalidError, /* unmapped error */
66 osl_Process_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
67 } oslProcessError;
68
69 #ifdef _WIN32
70 # pragma pack(push, 8)
71 #endif
72
73 typedef struct {
74 sal_uInt32 Size;
75 oslProcessData Fields;
76 oslProcessIdentifier Ident;
77 oslProcessExitCode Code;
78 TimeValue UserTime;
79 TimeValue SystemTime;
80 sal_uInt32 HeapUsage;
81 } oslProcessInfo;
82
83 #if defined( _WIN32)
84 # pragma pack(pop)
85 #endif
86
95 typedef void* oslProcess;
96
150 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_executeProcess(
151 rtl_uString* ustrImageName,
152 rtl_uString* ustrArguments[],
153 sal_uInt32 nArguments,
154 oslProcessOption Options,
155 oslSecurity Security,
156 rtl_uString* ustrDirectory,
157 rtl_uString* ustrEnvironments[],
158 sal_uInt32 nEnvironmentVars,
159 oslProcess* pProcess);
160
161
229 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
230 rtl_uString* strImageName,
231 rtl_uString* ustrArguments[],
232 sal_uInt32 nArguments,
233 oslProcessOption Options,
234 oslSecurity Security,
235 rtl_uString* ustrDirectory,
236 rtl_uString* ustrEnvironments[],
237 sal_uInt32 nEnvironmentVars,
238 oslProcess* pProcess,
239 oslFileHandle* pChildInputWrite,
240 oslFileHandle* pChildOutputRead,
241 oslFileHandle* pChildErrorRead);
242
251 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_terminateProcess(
252 oslProcess Process);
253
254
263 SAL_DLLPUBLIC oslProcess SAL_CALL osl_getProcess(
264 oslProcessIdentifier Ident) SAL_COLD;
265
266
271 SAL_DLLPUBLIC void SAL_CALL osl_freeProcessHandle(
272 oslProcess Process);
273
274
282 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_joinProcess(
283 oslProcess Process);
284
298 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_joinProcessWithTimeout(
299 oslProcess Process, const TimeValue* pTimeout);
300
317 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessInfo(
318 oslProcess Process, oslProcessData Fields, oslProcessInfo* pInfo);
319
331 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getExecutableFile(
332 rtl_uString **strFile);
333
338 SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_getCommandArgCount(void);
339
346 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getCommandArg(
347 sal_uInt32 nArg, rtl_uString **strCommandArg);
348
362 SAL_DLLPUBLIC void SAL_CALL osl_setCommandArgs (int argc, char **argv);
363
368 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getEnvironment(
369 rtl_uString *strVar, rtl_uString **strValue);
370
377 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setEnvironment(
378 rtl_uString *strVar, rtl_uString *strValue);
379
385 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_clearEnvironment(
386 rtl_uString *strVar);
387
394 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessWorkingDir(
395 rtl_uString **pustrWorkingDir );
396
402 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessLocale(
403 rtl_Locale ** ppLocale );
404
413 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setProcessLocale(
414 rtl_Locale * pLocale );
415
416 #ifdef __cplusplus
417 }
418 #endif
419
420 #endif // INCLUDED_OSL_PROCESS_H
421
422 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
oslFileHandle
void * oslFileHandle
Definition: file.h:626
oslProcessInfo
Definition: process.h:73
osl_getProcess
SAL_DLLPUBLIC oslProcess osl_getProcess(oslProcessIdentifier Ident) SAL_COLD
osl_joinProcessWithTimeout
SAL_DLLPUBLIC oslProcessError osl_joinProcessWithTimeout(oslProcess Process, const TimeValue *pTimeout)
Wait with a timeout for the completion of the specified child process.
osl_executeProcess
SAL_DLLPUBLIC oslProcessError osl_executeProcess(rtl_uString *ustrImageName, rtl_uString *ustrArguments[], sal_uInt32 nArguments, oslProcessOption Options, oslSecurity Security, rtl_uString *ustrDirectory, rtl_uString *ustrEnvironments[], sal_uInt32 nEnvironmentVars, oslProcess *pProcess)
Execute a process.
oslProcessOption
sal_Int32 oslProcessOption
Definition: process.h:38
osl_Process_E_NotFound
@ osl_Process_E_NotFound
Definition: process.h:61
file.h
Main goals and usage hints.
locale.h
osl_freeProcessHandle
SAL_DLLPUBLIC void osl_freeProcessHandle(oslProcess Process)
Free the specified process-handle.
saldllapi.h
oslSecurity
void * oslSecurity
Process handle.
Definition: security.h:45
oslProcessInfo::Fields
oslProcessData Fields
Definition: process.h:75
osl_setCommandArgs
SAL_DLLPUBLIC void osl_setCommandArgs(int argc, char **argv)
Set the command-line arguments as passed to the main-function of this process.
osl_clearEnvironment
SAL_DLLPUBLIC oslProcessError osl_clearEnvironment(rtl_uString *strVar)
Unsets the value of one environment variable.
osl_getProcessWorkingDir
SAL_DLLPUBLIC oslProcessError osl_getProcessWorkingDir(rtl_uString **pustrWorkingDir)
Get the working directory of the current process as a file URL.
oslProcessError
oslProcessError
Definition: process.h:59
time.h
osl_Process_E_Unknown
@ osl_Process_E_Unknown
Definition: process.h:64
osl_getCommandArgCount
SAL_DLLPUBLIC sal_uInt32 osl_getCommandArgCount(void)
oslProcessInfo::Code
oslProcessExitCode Code
Definition: process.h:77
osl_getCommandArg
SAL_DLLPUBLIC oslProcessError osl_getCommandArg(sal_uInt32 nArg, rtl_uString **strCommandArg)
Get the nArg-th command-line argument passed to the main-function of this process.
osl_Process_E_InvalidError
@ osl_Process_E_InvalidError
Definition: process.h:65
ustring.h
osl_setEnvironment
SAL_DLLPUBLIC oslProcessError osl_setEnvironment(rtl_uString *strVar, rtl_uString *strValue)
Set the value of one environment variable.
config.h
oslProcessInfo::UserTime
TimeValue UserTime
Definition: process.h:78
osl_Process_E_TimedOut
@ osl_Process_E_TimedOut
Definition: process.h:62
osl_terminateProcess
SAL_DLLPUBLIC oslProcessError osl_terminateProcess(oslProcess Process)
Terminate a process.
SAL_DLLPUBLIC
#define SAL_DLLPUBLIC
Definition: saldllapi.h:30
osl_joinProcess
SAL_DLLPUBLIC oslProcessError osl_joinProcess(oslProcess Process)
Wait for completion of the specified childprocess.
oslProcessInfo::SystemTime
TimeValue SystemTime
Definition: process.h:79
oslProcessInfo::Size
sal_uInt32 Size
Definition: process.h:74
osl_getProcessInfo
SAL_DLLPUBLIC oslProcessError osl_getProcessInfo(oslProcess Process, oslProcessData Fields, oslProcessInfo *pInfo)
Retrieves information about a Process.
oslProcessInfo::HeapUsage
sal_uInt32 HeapUsage
Definition: process.h:80
osl_executeProcess_WithRedirectedIO
SAL_DLLPUBLIC oslProcessError osl_executeProcess_WithRedirectedIO(rtl_uString *strImageName, rtl_uString *ustrArguments[], sal_uInt32 nArguments, oslProcessOption Options, oslSecurity Security, rtl_uString *ustrDirectory, rtl_uString *ustrEnvironments[], sal_uInt32 nEnvironmentVars, oslProcess *pProcess, oslFileHandle *pChildInputWrite, oslFileHandle *pChildOutputRead, oslFileHandle *pChildErrorRead)
Execute a process and redirect child process standard IO.
TimeValue
Definition: time.h:66
oslProcessExitCode
sal_uInt32 oslProcessExitCode
Definition: process.h:57
_rtl_Locale
The implementation structure of a locale.
Definition: locale.h:43
SAL_MAX_ENUM
#define SAL_MAX_ENUM
Definition: types.h:219
osl_setProcessLocale
SAL_DLLPUBLIC oslProcessError osl_setProcessLocale(rtl_Locale *pLocale)
Change the locale of the process.
osl_Process_E_FORCE_EQUAL_SIZE
@ osl_Process_E_FORCE_EQUAL_SIZE
Definition: process.h:66
oslProcessIdentifier
sal_uInt32 oslProcessIdentifier
Definition: process.h:56
oslProcessData
sal_Int32 oslProcessData
Definition: process.h:48
osl_getProcessLocale
SAL_DLLPUBLIC oslProcessError osl_getProcessLocale(rtl_Locale **ppLocale)
Get the locale the process is currently running in.
osl_Process_E_NoPermission
@ osl_Process_E_NoPermission
Definition: process.h:63
osl_getEnvironment
SAL_DLLPUBLIC oslProcessError osl_getEnvironment(rtl_uString *strVar, rtl_uString **strValue)
Get the value of one environment variable.
security.h
oslProcessInfo::Ident
oslProcessIdentifier Ident
Definition: process.h:76
oslProcess
void * oslProcess
Process handle.
Definition: process.h:95
osl_getExecutableFile
SAL_DLLPUBLIC oslProcessError osl_getExecutableFile(rtl_uString **strFile)
Get the filename of the executable.
osl_Process_E_None
@ osl_Process_E_None
Definition: process.h:60