LibreOffice: osl/process.h Source File

LibreOffice LibreOffice 25.2 SDK C/C++ API Reference |

Loading...
Searching...
No Matches
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 * This file is part of LibreOffice published API.
22 */
23
24#ifndef INCLUDED_OSL_PROCESS_H
25#define INCLUDED_OSL_PROCESS_H
26
27#include "sal/config.h"
28
29#include "osl/file.h"
30#include "osl/security.h"
31#include "osl/time.h"
32#include "rtl/locale.h"
33#include "rtl/ustring.h"
34#include "sal/saldllapi.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40
41 typedef sal_Int32 oslProcessOption;
42#define osl_Process_WAIT 0x0001 /* wait for completion */
43#define osl_Process_SEARCHPATH 0x0002 /* search path for executable */
44#define osl_Process_DETACHED 0x0004 /* run detached */
45#define osl_Process_NORMAL 0x0000 /* run in normal window */
46#define osl_Process_HIDDEN 0x0010 /* run hidden */
47#define osl_Process_MINIMIZED 0x0020 /* run in minimized window */
48#define osl_Process_MAXIMIZED 0x0040 /* run in maximized window */
49#define osl_Process_FULLSCREEN 0x0080 /* run in fullscreen window */
50
51 typedef sal_Int32 oslProcessData;
52
53/* defines for osl_getProcessInfo , can be OR'ed */
54#define osl_Process_IDENTIFIER 0x0001 /* retrieves the process identifier */
55#define osl_Process_EXITCODE 0x0002 /* retrieves exit code of the process */
56#define osl_Process_CPUTIMES 0x0004 /* retrieves used cpu time */
57#define osl_Process_HEAPUSAGE 0x0008 /* retrieves the used size of heap */
58
59 typedef sal_uInt32 oslProcessIdentifier;
60 typedef sal_uInt32 oslProcessExitCode;
61
62 typedef enum {
63 osl_Process_E_None, /* no error */
64 osl_Process_E_NotFound, /* image not found */
65 osl_Process_E_TimedOut, /* timeout occurred */
66 osl_Process_E_NoPermission, /* permission denied */
67 osl_Process_E_Unknown, /* unknown error */
68 osl_Process_E_InvalidError, /* unmapped error */
69 osl_Process_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
70} oslProcessError;
71
72#ifdef _WIN32
73# pragma pack(push, 8)
74#endif
75
76 typedef struct {
77 sal_uInt32 Size;
78 oslProcessData Fields;
79 oslProcessIdentifier Ident;
80 oslProcessExitCode Code;
81 TimeValue UserTime;
82 TimeValue SystemTime;
83 sal_uInt32 HeapUsage;
84} oslProcessInfo;
85
86#if defined( _WIN32)
87# pragma pack(pop)
88#endif
89
98 typedef void* oslProcess;
99
153 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_executeProcess(
154 rtl_uString* ustrImageName,
155 rtl_uString* ustrArguments[],
156 sal_uInt32 nArguments,
157 oslProcessOption Options,
158 oslSecurity Security,
159 rtl_uString* ustrDirectory,
160 rtl_uString* ustrEnvironments[],
161 sal_uInt32 nEnvironmentVars,
162 oslProcess* pProcess);
163
164
232 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
233 rtl_uString* strImageName,
234 rtl_uString* ustrArguments[],
235 sal_uInt32 nArguments,
236 oslProcessOption Options,
237 oslSecurity Security,
238 rtl_uString* ustrDirectory,
239 rtl_uString* ustrEnvironments[],
240 sal_uInt32 nEnvironmentVars,
241 oslProcess* pProcess,
242 oslFileHandle* pChildInputWrite,
243 oslFileHandle* pChildOutputRead,
244 oslFileHandle* pChildErrorRead);
245
254 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_terminateProcess(
255 oslProcess Process);
256
257
266 SAL_DLLPUBLIC oslProcess SAL_CALL osl_getProcess(
267 oslProcessIdentifier Ident) SAL_COLD;
268
269
274 SAL_DLLPUBLIC void SAL_CALL osl_freeProcessHandle(
275 oslProcess Process);
276
277
285 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_joinProcess(
286 oslProcess Process);
287
301 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_joinProcessWithTimeout(
302 oslProcess Process, const TimeValue* pTimeout);
303
320 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessInfo(
321 oslProcess Process, oslProcessData Fields, oslProcessInfo* pInfo);
322
334 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getExecutableFile(
335 rtl_uString **strFile);
336
341 SAL_DLLPUBLIC sal_uInt32 SAL_CALL osl_getCommandArgCount(void);
342
349 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getCommandArg(
350 sal_uInt32 nArg, rtl_uString **strCommandArg);
351
365 SAL_DLLPUBLIC void SAL_CALL osl_setCommandArgs (int argc, char **argv);
366
371 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getEnvironment(
372 rtl_uString *strVar, rtl_uString **strValue);
373
380 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setEnvironment(
381 rtl_uString *strVar, rtl_uString *strValue);
382
388 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_clearEnvironment(
389 rtl_uString *strVar);
390
396
397 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessWorkingDir(
398 rtl_uString **pustrWorkingDir );
399
404
405 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessLocale(
406 rtl_Locale ** ppLocale );
407
415
416 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setProcessLocale(
417 rtl_Locale * pLocale );
418
419#ifdef __cplusplus
420}
421#endif
422
423#endif // INCLUDED_OSL_PROCESS_H
424
425/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
saldllapi.h
SAL_DLLPUBLIC
#define SAL_DLLPUBLIC
Definition saldllapi.h:34
SAL_MAX_ENUM
#define SAL_MAX_ENUM
Definition types.h:205
config.h
ustring.h
locale.h
rtl_Locale
struct _rtl_Locale rtl_Locale
The implementation structure of a locale.
time.h
file.h
Main goals and usage hints.
oslFileHandle
void * oslFileHandle
Definition file.h:630
security.h
oslSecurity
void * oslSecurity
Process handle.
Definition security.h:49
oslProcessInfo
Definition process.h:76
oslProcessInfo::Size
sal_uInt32 Size
Definition process.h:77
oslProcessInfo::SystemTime
TimeValue SystemTime
Definition process.h:82
oslProcessInfo::Ident
oslProcessIdentifier Ident
Definition process.h:79
oslProcessInfo::Fields
oslProcessData Fields
Definition process.h:78
oslProcessInfo::Code
oslProcessExitCode Code
Definition process.h:80
oslProcessInfo::UserTime
TimeValue UserTime
Definition process.h:81
oslProcessInfo::HeapUsage
sal_uInt32 HeapUsage
Definition process.h:83
TimeValue
Time since Jan-01-1970.
Definition time.h:76
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_joinProcess
SAL_DLLPUBLIC oslProcessError osl_joinProcess(oslProcess Process)
Wait for completion of the specified childprocess.
osl_getProcess
SAL_DLLPUBLIC oslProcess osl_getProcess(oslProcessIdentifier Ident) SAL_COLD
osl_terminateProcess
SAL_DLLPUBLIC oslProcessError osl_terminateProcess(oslProcess Process)
Terminate a process.
oslProcessError
oslProcessError
Definition process.h:62
osl_Process_E_None
@ osl_Process_E_None
Definition process.h:63
osl_Process_E_InvalidError
@ osl_Process_E_InvalidError
Definition process.h:68
osl_Process_E_TimedOut
@ osl_Process_E_TimedOut
Definition process.h:65
osl_Process_E_Unknown
@ osl_Process_E_Unknown
Definition process.h:67
osl_Process_E_NoPermission
@ osl_Process_E_NoPermission
Definition process.h:66
osl_Process_E_FORCE_EQUAL_SIZE
@ osl_Process_E_FORCE_EQUAL_SIZE
Definition process.h:69
osl_Process_E_NotFound
@ osl_Process_E_NotFound
Definition process.h:64
osl_getCommandArgCount
SAL_DLLPUBLIC sal_uInt32 osl_getCommandArgCount(void)
osl_getProcessInfo
SAL_DLLPUBLIC oslProcessError osl_getProcessInfo(oslProcess Process, oslProcessData Fields, oslProcessInfo *pInfo)
Retrieves information about a Process.
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_getProcessWorkingDir
SAL_DLLPUBLIC oslProcessError osl_getProcessWorkingDir(rtl_uString **pustrWorkingDir)
Get the working directory of the current process as a file URL.
oslProcessExitCode
sal_uInt32 oslProcessExitCode
Definition process.h:60
osl_setEnvironment
SAL_DLLPUBLIC oslProcessError osl_setEnvironment(rtl_uString *strVar, rtl_uString *strValue)
Set the value of one environment variable.
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:41
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.
oslProcessIdentifier
sal_uInt32 oslProcessIdentifier
Definition process.h:59
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.
oslProcessData
sal_Int32 oslProcessData
Definition process.h:51
osl_getProcessLocale
SAL_DLLPUBLIC oslProcessError osl_getProcessLocale(rtl_Locale **ppLocale)
Get the locale the process is currently running in.
osl_getExecutableFile
SAL_DLLPUBLIC oslProcessError osl_getExecutableFile(rtl_uString **strFile)
Get the filename of the executable.
osl_setProcessLocale
SAL_DLLPUBLIC oslProcessError osl_setProcessLocale(rtl_Locale *pLocale)
Change the locale of the process.
oslProcess
void * oslProcess
Process handle.
Definition process.h:98
osl_clearEnvironment
SAL_DLLPUBLIC oslProcessError osl_clearEnvironment(rtl_uString *strVar)
Unsets the value of one environment variable.
osl_freeProcessHandle
SAL_DLLPUBLIC void osl_freeProcessHandle(oslProcess Process)
Free the specified process-handle.
osl_getEnvironment
SAL_DLLPUBLIC oslProcessError osl_getEnvironment(rtl_uString *strVar, rtl_uString **strValue)
Get the value of one environment variable.