You are on page 1of 8

Library Description:

CoDeSys V 3.x
SysProcess.library

Document Version 1.0


libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH page 1 of 9


SysProcess_V3x_E.doc
Library SysProcess.library

CONTENT

1 OVERVIEW 4

2 LIBRARY MODULES 5
2.1 SysProcessCreate 5
2.2 SysProcessCreate2 5
2.3 SysProcessExecuteCommand 5
2.4 SysProcessFreeHandle 6
2.5 SysProcessGetCurrentHandle 6
2.6 SysProcessGetOSId 6
2.7 SysProcessGetPriority 6
2.8 SysProcessGetState 7
2.9 SysProcessResume 7
2.10 SysProcessSetPriority 7
2.11 SysProcessTerminate 8
2.12 Global_Constants 8

CHANGE HISTORY 9
libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH page 3 of 9


SysProcess_V3x_E.doc
Library SysProcess.library

1 Overview

Note: It depends on the target system, which system libraries can be used in the application program.

This library allows to manage the processes on the target system provided the target system
is working with single processes and admits their handling.

The functions:

SysProcessCreate
SysProcessCreate2
SysProcessExecuteCommand
SysProcessFreeHandle
SysProcessGetCurrentHandle
SysProcessGetOSId
SysProcessGetPriority
SysProcessGetState
SysProcessSetPriority
SysProcessTerminate

The global constants:

SYSPROCESS_INVALID_HANDLE
SYSPROCESS_CREATEFLAG_HIDDEN
SYSPROCESS_CREATEFLAG_INTERACTIVE
SYSPROCESS_CREATEFLAG_CREATESUSPENDED
libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH page 4 of 9


SysProcess_V3x_E.doc
Library SysProcess.library

2 Library Modules

2.1 SysProcessCreate
This function starts the specified application as new process, optionally either in the fore- or in
the background.

The return of type UDINT contains a handle of the newly created process.
Input variable Data type Description

pszApplication STRING Name of application to be started

pszCommandLine STRING Command line parameters to be added to


application name at call; will not be evaluated by
every runtime system.
ulHide UDINT The application runs in the background for uIHide=1,
else in the foreground.
pResult POINTER TO Pointer to error code; see document "Runtime Error
UDINT Codes".

2.2 SysProcessCreate2
This functions creates and eventually starts a new process for the specified application. The
properties of the created process can be defined by appropriate flags (see 2.12)

The return of type UDINT contains a handle of the newly created process.
Input variable Data type Description

pszApplication STRING Name of application the process shall be created for

pszCommandLine STRING Command line parameters to be added to


application name at call; will not be evaluated by
every runtime system.
ulFlags UDINT Combination of flags defining the properties of the
newly created process (see 2.12)
pResult POINTER TO Pointer to error code; see document "Runtime Error
UDINT Codes".

2.3 SysProcessExecuteCommand
This function starts the execution of a system command. The realization of the command
execution depends on the operating system.

The return of type UDINT contains the result of the command execution (Pay attention to the
explicit cast to type UDINT!).
Input variable Data type Description
libdoc_e.dot / V1.0

pszCommand REFERENCE TO Command to be executed


STRING
pResult POINTER TO Pointer to error code; see document "Runtime Error
UDINT Codes".

3S - Smart Software Solutions GmbH page 5 of 9


SysProcess_V3x_E.doc
Library SysProcess.library

2.4 SysProcessFreeHandle
By use of this function a process handle is released.

The return of type UDINT is an error code indicating success or failure of the operation
(ERR_OK or ERR_PARAMETER for invalid handle).
Input variable Data type Description

hProcess UDINT ID (handle) of process; returned by


SysProcessCreate or SysProcessGetCurrentHandle

2.5 SysProcessGetCurrentHandle
This function retrieves the handle of the process actually run by the processor.

The handle of type UDINT will be returned. .


Input variable Data type Description

pResult POINTER TO Pointer to error code; see document "Runtime Error


UDINT Codes".

2.6 SysProcessGetOSId
This function retrieves the operating system specific identification of the process. This
identification always has to be unique within the system. SysProcessGetOSId can only
applied to the process actually executed or to processes having been generated by
SysProcessCreate.

The return of type UDINT contains the operating system specific identification of the process.
Input variable Data type Description

hProcess UDINT ID (handle) of process; returned by


SysProcessCreate or SysProcessGetCurrentHandle
pResult POINTER TO Pointer to error code; see document "Runtime Error
UDINT Codes".

2.7 SysProcessGetPriority
This function retrieves the priority of the process specified by its handle.

The return of type UDINT is an error code indicating success or failure of the operation
(ERR_OK or ERR_PARAMETER for invalid handle).
Input variable Data type Description

hProcess UDINT ID (handle) of process; returned by


SysProcessCreate or SysProcessGetCurrentHandle
pulPriority POINTER TO Pointer to variable being assigned to priority of the
UDINT process
libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH page 6 of 9


SysProcess_V3x_E.doc
Library SysProcess.library

2.8 SysProcessGetState
This function retrieves the status of the process specified by its handle.

The return of type UDINT is an error code indicating success or failure of the operation
(ERR_OK or ERR_PARAMETER for invalid handle).
Input variable Data type Description

hProcess UDINT ID (handle) of process; returned by


SysProcessCreate or SysProcessGetCurrentHandle
pulState POINTER TO Pointer to variable being assigned to value 1 for
UDINT running processes and value 2 for terminated
processes

2.9 SysProcessResume
This function starts the process specified by its handle. For example, the function can be used
for processes having been created in suspended mode by use of the flag
SYSPROCESS_CREATEFLAG_CREATESUSPENDED (see 2.2).

The return of type UDINT is an error code indicating success or failure of the operation
(ERR_OK or ERR_PARAMETER for invalid handle).
Input variable Data type Description

hProcess UDINT ID (handle) of process; returned by


SysProcessCreate or SysProcessGetCurrentHandle

2.10 SysProcessSetPriority
This function sets the priority of the process specified by its handle.

The return of type UDINT is an error code indicating success or failure of the operation
(ERR_OK or ERR_PARAMETER for invalid handle).
Input variable Data type Description

hProcess UDINT ID (handle) of process; returned by


SysProcessCreate or SysProcessGetCurrentHandle
pulPriority UDINT Priority to be set; valid values range from 0 to 255.
Category Range of values

system level 0..31


real-time 32..63
high 64..95
above-average 96..127
normal 128..159
below-average 160..191
low 192..223
libdoc_e.dot / V1.0

minor 224..255

3S - Smart Software Solutions GmbH page 7 of 9


SysProcess_V3x_E.doc
Library SysProcess.library

2.11 SysProcessTerminate
This function terminates the process specified by its handle.

The return of type UDINT is an error code indicating success or failure of the operation
(ERR_OK or ERR_PARAMETER for invalid handle).
Input variable Data type Description

hProcess UDINT ID (handle) of process; returned by


SysProcessCreate or
SysProcessGetCurrentHandle

2.12 Global_Constants
This variable list contains global variables that are used within the management of processes.
To build a combination of the flags, which represents all desired properties, the values of the
corresponding flag variables must been added. The flags are not supported by every runtime
system.
Name of variable Data type Description

SYSPROCESS_INVALID_HANDLE UDINT Value of invalid ID (handle) of a process; see


SysProcessCreate or
SysProcessGetCurrentHandle

The following constants are only used by the function SysProcessCreate2 (2.2):
Name of variable Data type Description

SYSPROCESS_CREATEFLAG_HID UDINT Flag to create a hidden process


DEN

SYSPROCESS_CREATEFLAG_INT UDINT Flag to create an interactive process requiring


ERACTIVE input from the user

SYSPROCESS_CREATEFLAG_CR UDINT Flag to create a suspended process


EATESUSPENDED
libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH page 8 of 9


SysProcess_V3x_E.doc
Library SysProcess.library

Change History
Version Description Date

0.1 Creation according to German version 1.0 19.02.2008


1.0 Release after formal review 20.02.2008
libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH page 9 of 9


SysProcess_V3x_E.doc

You might also like