OSAPI  0.29
Open System API
PROC

The process management module. More...

Collaboration diagram for PROC:

Typedefs

typedef struct osapi_proc_id_S t_proc_id
 The Process identity type.
 
typedef struct osapi_proc_info_S t_proc_info
 The process information type.
 
typedef struct osapi_proc_libinfo_S t_libinfo
 Define the library info type.
 
typedef struct osapi_proc_resources_S t_proc_resources
 The process resources type.
 
typedef union osapi_proc_upid_U t_upid
 Define the Unique PID.
 

Functions

t_status proc_module_supported (void)
 Is PROC module supported in the platform. More...
 
t_status proc_buffer_allocate (size_t bufsize, t_buffer *buffer)
 Allocate memory in the HEAP using a buffer. More...
 
t_status proc_buffer_reAllocate (t_size bufsize, t_buffer *buffer)
 Resize buffer memory. More...
 
t_status proc_buffer_deallocate (t_buffer *buffer)
 Deallocate buffer memory. More...
 
t_status proc_buffer_getCapacity (const t_buffer *buffer, t_size *size)
 Get the buffer capacity. More...
 
t_status proc_buffer_getData (const t_buffer *buffer, void **data)
 Get the buffer (naked) memory address. More...
 
t_status proc_buffer_getSize (const t_buffer *buffer, t_size *size)
 Get the current buffer memory usage. More...
 
t_status proc_buffer_setSize (t_size size, t_buffer *buffer)
 Set the current buffer memory usage. More...
 
t_status proc_buffer_copy (const t_buffer *source, t_buffer *target)
 Copy two buffer memories Buffers cannot overlap in any way (this generates an error) More...
 
t_status proc_buffer_copyFrom (const t_buffer *source, t_size targetSize, void *target)
 Copy from a buffer to a naked/raw memory location. More...
 
t_status proc_buffer_copyTo (const void *source, t_size sourceSize, t_buffer *target)
 Copy from a naked/raw memory into a buffer memory. More...
 
t_status proc_id_get (t_pid *pid)
 Get the current process ID. More...
 
t_status proc_id_getParent (t_pid pid, t_pid *ppid)
 Get the parent process ID. More...
 
t_status proc_id_getDescendents (t_pid pid, t_size tsize, t_size *csize, t_pid(*array)[])
 Get list of process IDs of children processes. More...
 
t_status proc_id_getUser (t_pid pid, t_uid *uid)
 Get the User ID of the given process. More...
 
t_status proc_id_getGroup (t_pid pid, t_gid *gid)
 Get the Group ID of the current process. More...
 
t_status proc_id_getSession (t_pid pid, t_pid *sid)
 Get Session Identifier. More...
 
t_status proc_id_setSession (void)
 Create a new Session. A new session is created with the current PID as being the Session ID. More...
 
t_status proc_id_getGroupMembers (t_pid pgid, t_size initialMembers, t_size *currentMembers, t_pid(*idList)[])
 Get the List of IDs of Process Group members. More...
 
t_status proc_id_getSessionMembers (t_pid sid, t_size initialMembers, t_size *currentMembers, t_pid(*idList)[])
 Get the List of IDs of Process Session members. More...
 
t_status proc_id_toString (t_pid pid, t_size size, t_char *string)
 Convert a process ID to a C-String format. More...
 
t_status proc_id_fromString (t_char *string, t_pid *pid)
 Convert a C-String into a process ID. More...
 
t_status proc_id_copy (t_pid source, t_pid *target)
 Copy a source process ID to a target variable. More...
 
t_status proc_id_clear (t_pid *pid)
 Reset ID to a default (and possible non usable) value. More...
 
t_status proc_uid_get (t_upid *upid)
 Get the current process Unique ID A Process Unique ID is a unique incarnation of a process instance, i.e. no two processes will have the same UPID in the same node. More...
 
t_status proc_info_get (t_pid pid, t_proc_info *info)
 Obtain raw process information This is the function call that allows clients to make a single call and obtain all raw process data. More...
 
t_status proc_info_getVirtualMemory (t_proc_info *info, t_size *size)
 Extract the size of the process virtual memory from the process information. More...
 
t_status proc_info_getRealMemory (t_proc_info *info, t_size *size)
 Extract the size of the process real memory, i.e. ram usage, from the process information. More...
 
t_status proc_info_getCPUConsumption (t_proc_info *info, t_size *size)
 Extract the process CPU consumption (summary of user and system) from the process information. More...
 
t_status proc_info_getThreads (t_proc_info *info, t_size *number)
 Extract the number of process kernel threads / LWPs from the process information. More...
 
t_status proc_info_getStartTime (t_proc_info *info, t_time *start)
 Extract the process start time from the process information. More...
 
t_status proc_instance_create (t_proc *proc)
 Create a new process instance. More...
 
t_status proc_instance_destroy (t_pid pid, int forced)
 Terminate a running process. More...
 
t_status proc_instance_clone (int *isChild)
 Clone the current process. More...
 
t_status proc_instance_isRunning (t_pid pid)
 Is a process instance running. More...
 
t_status proc_instance_getState (t_pid pid, int *state)
 Obtain the state of a given process. More...
 
t_status proc_instance_getChildStatus (t_pid *pid, t_proc_status *status)
 Obtain status of a child process. More...
 
t_status proc_instance_getStatus (t_pid pid, t_proc_status *status)
 Obtain a status of a process. More...
 
t_status proc_instance_getNumberOfDescendents (t_pid pid, t_size *number)
 Obtain the number of children processes. More...
 
t_status proc_instance_getNumberOfGroupMembers (t_pid pgid, t_size *number)
 Obtain the number of process group members. More...
 
t_status proc_instance_getNumberOfSessionMembers (t_pid sid, t_size *number)
 Obtain the number of process session members. More...
 
OSAPI_NORETURN void proc_instance_terminate (int code)
 Terminate the current process. It always succeeds. More...
 
t_status proc_instance_suspendExecution (void)
 Suspend the execution of the current thread until an event occurs such as a signal in UNIX. More...
 
t_status proc_library_supported (void)
 Is the load/unload of libraries supported in the platform? More...
 
t_status proc_library_load (char *path, char *options[], t_library *lib)
 Load a library into the current process. More...
 
t_status proc_library_unload (t_library lib)
 Unload a library from the current process. More...
 
t_status proc_library_getNumberOfLoaded (t_size *maxlibs)
 Get the number of shared libraries loaded in the process. More...
 
t_status proc_library_getAllLoaded (t_size maxlibs, t_libinfo(*info)[])
 Get a list of name and version information for each process loaded/shared library. More...
 
t_status proc_library_getRelease (const t_char *name, t_size max, char *release)
 Get the Release information of the named library. More...
 
t_status proc_list_allocate (t_size nItems, t_size itemSize, t_list *list)
 Allocate memory in the HEAP for a list of items The "list" is implemented as an array of bytes. More...
 
t_status proc_list_reAllocate (t_size nItems, t_list *list)
 Resize a list of items. More...
 
t_status proc_list_deallocate (t_list *list)
 Deallocate list. More...
 
t_status proc_list_getCapacity (const t_list *list, t_size *size)
 Get the list capacity in terms of allocated items. More...
 
t_status proc_list_hasCapacity (const t_list *list, t_size size)
 Check if the list can store N items. More...
 
t_status proc_list_getRequiredCapacity (const t_list *list, t_size *size)
 Get the required list capacity in terms of allocated items The required capacity is needed in case a list is not big enough to hold all elements. More...
 
t_status proc_list_getData (const t_list *list, t_size item, void **data)
 Get the memory address of a given data item (of a list) More...
 
t_status proc_list_getSize (const t_list *list, t_size *size)
 Get the current list usage in terms of number of items. More...
 
t_status proc_list_setSize (t_size size, t_list *list)
 Set the current list usage. More...
 
t_status proc_list_setRequiredCapacity (t_size size, t_list *list)
 Set the current list required capacity The required capacity is needed in case a list is not big enough to hold all elements. More...
 
t_status proc_list_copy (const t_list *source, t_list *target)
 Copy two list memories List cannot overlap in any way (this generates an error) More...
 
t_status proc_list_copyFrom (const t_list *source, t_size sourceItem, t_size targetSize, void *target)
 Copy from a list item to a naked/raw memory location. More...
 
t_status proc_list_copyTo (const void *source, t_size sourceSize, t_size targetItem, t_list *target)
 Copy from a naked/raw memory into a list item. More...
 
t_status proc_rawMemory_allocate (t_size size, Byte type, void *mem)
 Allocate memory in the process heap. More...
 
t_status proc_rawMemory_reAllocate (t_size newSize, void *mem)
 Resize the previously allocated memory in the process heap. More...
 
t_status proc_rawMemory_deallocate (void *mem)
 Deallocate a previously allocated heap memory block. More...
 
t_status proc_memory_allocate (t_size size, Byte type, t_memory *mem)
 Allocate memory in the process heap. More...
 
t_status proc_memory_reAllocate (t_size newSize, t_memory *mem)
 Resize the previously allocated memory in the process heap. More...
 
t_status proc_memory_deallocate (t_memory *location)
 Deallocate a previously allocated heap memory block. More...
 
t_status proc_memory_getCapacity (const t_memory *mem, t_size *size)
 Retrieve the total allocated memory size, in bytes. More...
 
t_status proc_memory_getData (const t_memory *mem, void **data)
 Get the raw memory address for the given memory descriptor. More...
 
t_status proc_memory_copy (const t_memory *source, t_memory *target)
 Copy between two memories using memory descriptors. More...
 
t_status proc_memory_copyFrom (const t_memory *source, t_size targetSize, void *target)
 Copy from a memory descriptor into a raw memory. More...
 
t_status proc_memory_copyTo (const void *source, t_size sourceSize, t_memory *target)
 Copy from a raw source memory into a memory descriptor. More...
 
t_status proc_data_clear (t_proc *proc)
 Reset process plan information to default system specific values. More...
 
t_status proc_data_setName (t_char *name, t_proc *proc)
 Set the name of the new process. More...
 
t_status proc_data_setUser (t_uid uid, t_proc *proc)
 Change the current process User ID. More...
 
t_status proc_data_setGroup (t_gid gid, t_proc *proc)
 Change the current process Group ID. More...
 
t_status proc_data_setCmdLine (t_size size, char *array[], t_proc *proc)
 Fills a process data structure with the execution command line. More...
 
t_status proc_data_setEnvironment (t_size size, char *array[], t_proc *proc)
 Fills a process data structure with the new process environment. More...
 
t_status proc_data_getName (t_proc *proc, t_char **name)
 Get the name of the planned process. More...
 
t_status proc_data_getCmdLine (t_proc *proc, t_size *nargs, char ***args)
 Obtains the command line argument list. More...
 
t_status proc_data_getEnvironment (t_proc *proc, t_size *nargs, char ***environ)
 Fills a process data structure with the new process environment. More...
 
t_status proc_data_getPID (t_proc *proc, t_pid *pid)
 Retrieve the process ID from the process type. More...
 
t_status proc_data_getUser (t_proc *proc, t_uid *uid)
 Retrieve the User ID from the process type. More...
 
t_status proc_data_getGroup (t_proc *proc, t_gid *gid)
 Retrieve the User ID from the process type. More...
 
t_status proc_resource_getVirtualMemory (t_pid pid, t_size *size)
 Get the size of the process virtual memory. More...
 
t_status proc_resource_getRealMemory (t_pid pid, t_size *size)
 Get the size of the process real memory, i.e. ram usage. More...
 
t_status proc_resource_getCPU (t_pid pid, t_size *size)
 Get the process CPU consumption (summary of user and system) More...
 
t_status proc_resource_getThreads (t_pid pid, t_size *number)
 Get the number of process kernel threads / LWPs. More...
 
t_status proc_signal_supported (int *supportLevel)
 Are signals supported by the OSAPI library? More...
 
t_status proc_signal_clearAll (void)
 Unblock of all signals. If there are any blocked signal, these will be unblocked. More...
 
t_status proc_signal_send (t_pid pid, t_signal sigNumber)
 Send a signal to a process The signal identifier will be the standard POSIX constant SIG_xxx. More...
 
t_status proc_signal_sendByName (t_pid pid, t_char *sigName)
 Send a signal to a process The signal identifier will be the standard POSIX name "SIG_xxx". More...
 
t_status proc_signal_setHandler (t_signal sigNumber, t_sig_func sigFunc)
 Set a signal handler function for a given signal number. More...
 
t_status proc_signal_setHandlerByName (t_char *sigName, t_sig_func sigFunc)
 Set a signal handler function for a given signal name. More...
 
t_status proc_signal_resetHandler (t_signal sigNumber)
 Reset a signal to the default behavior. More...
 
t_status proc_signal_resetHandlerByName (t_char *sigName)
 Reset a signal to the default behavior. More...
 
t_status proc_signal_getName (t_signal sigNumber, t_char **sigName)
 Get the name of a signal The function maps a signal number to a signal name. More...
 
t_status proc_signal_getNumber (t_char *sigName, t_signal *sigNumber)
 Get the name of a signal The function maps a signal number to a signal name. More...
 
t_status proc_time_getStart (t_pid pid, t_time *start)
 Get the start time of a process. More...
 

Detailed Description

The process management module.


Function Documentation

◆ proc_buffer_allocate()

t_status proc_buffer_allocate ( size_t  bufsize,
t_buffer buffer 
)

Allocate memory in the HEAP using a buffer.

Parameters
[in]bufsize- Size of the buffer to allocate
[out]buffer- Address of the buffer memory
Returns
Operation status

◆ proc_buffer_copy()

t_status proc_buffer_copy ( const t_buffer source,
t_buffer target 
)

Copy two buffer memories Buffers cannot overlap in any way (this generates an error)

Parameters
[in]source- Address of the source buffer
[out]target- Address of the target/destination buffer
Returns
Operation status

◆ proc_buffer_copyFrom()

t_status proc_buffer_copyFrom ( const t_buffer source,
t_size  targetSize,
void *  target 
)

Copy from a buffer to a naked/raw memory location.

Parameters
[in]source- Address of the source buffer
[in]targetSize- Size of destination memory buffer
[out]target- Raw destination memory address
Returns
Operation status

◆ proc_buffer_copyTo()

t_status proc_buffer_copyTo ( const void *  source,
t_size  sourceSize,
t_buffer target 
)

Copy from a naked/raw memory into a buffer memory.

Parameters
[in]source- Raw source memory address
[in]sourceSize- Size of the source memory content
[out]target- Address of the target/destination buffer
Returns
Operation status

◆ proc_buffer_deallocate()

t_status proc_buffer_deallocate ( t_buffer buffer)

Deallocate buffer memory.

Parameters
[in]buffer- Address of the buffer memory
Returns
Operation status

◆ proc_buffer_getCapacity()

t_status proc_buffer_getCapacity ( const t_buffer buffer,
t_size size 
)

Get the buffer capacity.

Parameters
[in]buffer- Address of the buffer memory
[out]size- Buffer capacity
Returns
Operation status

◆ proc_buffer_getData()

t_status proc_buffer_getData ( const t_buffer buffer,
void **  data 
)

Get the buffer (naked) memory address.

Parameters
[in]buffer- Address of the buffer memory
[out]data- Address of the managed naked/raw HEAP memory
Returns
Operation status

◆ proc_buffer_getSize()

t_status proc_buffer_getSize ( const t_buffer buffer,
t_size size 
)

Get the current buffer memory usage.

Parameters
[in]buffer- Address of the buffer memory
[out]size- Current memory usage
Returns
Operation status

◆ proc_buffer_reAllocate()

t_status proc_buffer_reAllocate ( t_size  bufsize,
t_buffer buffer 
)

Resize buffer memory.

Parameters
[in]bufsize- New size of the buffer
[out]buffer- Address of the buffer memory
Returns
Operation status

◆ proc_buffer_setSize()

t_status proc_buffer_setSize ( t_size  size,
t_buffer buffer 
)

Set the current buffer memory usage.

Parameters
[in]size- New current memory usage
[out]buffer- Address of the buffer memory
Returns
Operation status

◆ proc_data_clear()

t_status proc_data_clear ( t_proc *  proc)

Reset process plan information to default system specific values.

Parameters
[in,out]proc- process type
Returns
Operation status

◆ proc_data_getCmdLine()

t_status proc_data_getCmdLine ( t_proc *  proc,
t_size nargs,
char ***  args 
)

Obtains the command line argument list.

Parameters
[in]proc- Process type
[out]nargs- The number of command line arguments
[out]args- The command line arguments
Returns
Operation status

◆ proc_data_getEnvironment()

t_status proc_data_getEnvironment ( t_proc *  proc,
t_size nargs,
char ***  environ 
)

Fills a process data structure with the new process environment.

Parameters
[in]proc- Process type
[out]nargs- The number of environment arguments
[out]environ- The environment arguments
Returns
Operation status

◆ proc_data_getGroup()

t_status proc_data_getGroup ( t_proc *  proc,
t_gid *  gid 
)

Retrieve the User ID from the process type.

Parameters
[in]proc- Process type
[out]gid- User ID
Returns
Operation status

◆ proc_data_getName()

t_status proc_data_getName ( t_proc *  proc,
t_char **  name 
)

Get the name of the planned process.

Parameters
[in]proc- process type
[out]name- Process name
Returns
Operation status

◆ proc_data_getPID()

t_status proc_data_getPID ( t_proc *  proc,
t_pid *  pid 
)

Retrieve the process ID from the process type.

Parameters
[in]proc- Process type
[out]pid- process ID
Returns
Operation status

◆ proc_data_getUser()

t_status proc_data_getUser ( t_proc *  proc,
t_uid *  uid 
)

Retrieve the User ID from the process type.

Parameters
[in]proc- Process type
[out]uid- User ID
Returns
Operation status

◆ proc_data_setCmdLine()

t_status proc_data_setCmdLine ( t_size  size,
char *  array[],
t_proc *  proc 
)

Fills a process data structure with the execution command line.

Parameters
[in]size- Number of elements of the (C-String) array
[in]array- The command line array
[out]proc- The process type
Returns
Operation status

◆ proc_data_setEnvironment()

t_status proc_data_setEnvironment ( t_size  size,
char *  array[],
t_proc *  proc 
)

Fills a process data structure with the new process environment.

Parameters
[in]size- Number of elements of the C-String array
[in]array- The environment array
[out]proc- The process type
Returns
Operation status

◆ proc_data_setGroup()

t_status proc_data_setGroup ( t_gid  gid,
t_proc *  proc 
)

Change the current process Group ID.

Parameters
[in]gid- New Group ID
[out]proc- process type
Returns
Operation status

◆ proc_data_setName()

t_status proc_data_setName ( t_char name,
t_proc *  proc 
)

Set the name of the new process.

Parameters
[in]name- Process name
[out]proc- process type
Returns
Operation status

◆ proc_data_setUser()

t_status proc_data_setUser ( t_uid  uid,
t_proc *  proc 
)

Change the current process User ID.

Parameters
[in]uid- New User ID
[out]proc- process type
Returns
Operation status

◆ proc_id_clear()

t_status proc_id_clear ( t_pid *  pid)

Reset ID to a default (and possible non usable) value.

Parameters
[in,out]pid- The process ID variable to reset
Returns
Operation status

◆ proc_id_copy()

t_status proc_id_copy ( t_pid  source,
t_pid *  target 
)

Copy a source process ID to a target variable.

Parameters
[in]source- The process ID to copy
[out]target- The copied process ID
Returns
Operation status

◆ proc_id_fromString()

t_status proc_id_fromString ( t_char string,
t_pid *  pid 
)

Convert a C-String into a process ID.

Parameters
[in]string- The C-String to be converted into a process ID
[out]pid- The process ID obtained from the C-String
Returns
Operation status

◆ proc_id_get()

t_status proc_id_get ( t_pid *  pid)

Get the current process ID.

Parameters
[out]pid- The process ID
Returns
Operation status
Here is the caller graph for this function:

◆ proc_id_getDescendents()

t_status proc_id_getDescendents ( t_pid  pid,
t_size  tsize,
t_size csize,
t_pid(*)  array[] 
)

Get list of process IDs of children processes.

Parameters
[in]pid- The process ID for which children are obtained
[in]tsize- The size of the array
[out]csize- The number of found children processes
[out]array- List of process IDs of children
Returns
Operation status

◆ proc_id_getGroup()

t_status proc_id_getGroup ( t_pid  pid,
t_gid *  gid 
)

Get the Group ID of the current process.

Parameters
[in]pid- Target Process ID
[out]gid- User ID
Returns
Operation status

◆ proc_id_getGroupMembers()

t_status proc_id_getGroupMembers ( t_pid  pgid,
t_size  initialMembers,
t_size currentMembers,
t_pid(*)  idList[] 
)

Get the List of IDs of Process Group members.

Parameters
[in]pgid- The target Process Group ID for which to retrieve the member IDs
[in]initialMembers- Number of found members of group / Size of the array
[out]currentMembers- Number of members discovered during the execution of the operations / Current array size
[out]idList- List with process IDs of group members
Returns
Operation status

◆ proc_id_getParent()

t_status proc_id_getParent ( t_pid  pid,
t_pid *  ppid 
)

Get the parent process ID.

Parameters
[in]pid- The process ID for which the parent ID process is required
[out]ppid- The parent process ID
Returns
Operation status

◆ proc_id_getSession()

t_status proc_id_getSession ( t_pid  pid,
t_pid *  sid 
)

Get Session Identifier.

Parameters
[in]pid- Target Process ID
[out]sid- Session ID
Returns
Operation status

◆ proc_id_getSessionMembers()

t_status proc_id_getSessionMembers ( t_pid  sid,
t_size  initialMembers,
t_size currentMembers,
t_pid(*)  idList[] 
)

Get the List of IDs of Process Session members.

Parameters
[in]sid- The target Process Session ID for which to retrieve the member IDs
[in]initialMembers- Number of found members of group / Size of the array
[out]currentMembers- Number of members discovered during the execution of the operations / Current array size
[out]idList- List with process IDs of session members
Returns
Operation status

◆ proc_id_getUser()

t_status proc_id_getUser ( t_pid  pid,
t_uid *  uid 
)

Get the User ID of the given process.

Parameters
[in]pid- Target Process ID
[out]uid- User ID
Returns
Operation status

◆ proc_id_setSession()

t_status proc_id_setSession ( void  )

Create a new Session. A new session is created with the current PID as being the Session ID.

Returns
Operation status

◆ proc_id_toString()

t_status proc_id_toString ( t_pid  pid,
t_size  size,
t_char string 
)

Convert a process ID to a C-String format.

Parameters
[in]pid- The process ID to convert to string
[in]size- Size of the output string
[out]string- Process ID in C-String format
Returns
Operation status

◆ proc_info_get()

t_status proc_info_get ( t_pid  pid,
t_proc_info info 
)

Obtain raw process information This is the function call that allows clients to make a single call and obtain all raw process data.

Parameters
[in]pid- Process ID
[out]info- Process information
Returns
Operation status
Here is the caller graph for this function:

◆ proc_info_getCPUConsumption()

t_status proc_info_getCPUConsumption ( t_proc_info info,
t_size size 
)

Extract the process CPU consumption (summary of user and system) from the process information.

Parameters
[in]info- Process information
[out]size- Percentage of consumed process CPU
Returns
Operation status

◆ proc_info_getRealMemory()

t_status proc_info_getRealMemory ( t_proc_info info,
t_size size 
)

Extract the size of the process real memory, i.e. ram usage, from the process information.

Parameters
[in]info- Process information
[out]size- Real memory size in bytes
Returns
Operation status

◆ proc_info_getStartTime()

t_status proc_info_getStartTime ( t_proc_info info,
t_time start 
)

Extract the process start time from the process information.

Parameters
[in]info- Process information
[out]start- Process start time
Returns
Operation status

◆ proc_info_getThreads()

t_status proc_info_getThreads ( t_proc_info info,
t_size number 
)

Extract the number of process kernel threads / LWPs from the process information.

Parameters
[in]info- Process information
[out]number- Number of process threads
Returns
Operation status

◆ proc_info_getVirtualMemory()

t_status proc_info_getVirtualMemory ( t_proc_info info,
t_size size 
)

Extract the size of the process virtual memory from the process information.

Parameters
[in]info- Process information
[out]size- Virtual memory size in bytes
Returns
Operation status

◆ proc_instance_clone()

t_status proc_instance_clone ( int *  isChild)

Clone the current process.

Parameters
[out]isChild- Child or father
Returns
Operation status

◆ proc_instance_create()

t_status proc_instance_create ( t_proc *  proc)

Create a new process instance.

Parameters
[in,out]proc- process type
Returns
Operation status

◆ proc_instance_destroy()

t_status proc_instance_destroy ( t_pid  pid,
int  forced 
)

Terminate a running process.

Parameters
[in]pid- The process to terminate
[in]forced- Normal or forced termination
Returns
Operation status

◆ proc_instance_getChildStatus()

t_status proc_instance_getChildStatus ( t_pid *  pid,
t_proc_status *  status 
)

Obtain status of a child process.

Parameters
[in]pid- Process ID
[out]status- Status of child process
Returns
Operation status

◆ proc_instance_getNumberOfDescendents()

t_status proc_instance_getNumberOfDescendents ( t_pid  pid,
t_size number 
)

Obtain the number of children processes.

Parameters
[in]pid- Get descendants of this process
[out]number- Number of children processes
Returns
Operation status

◆ proc_instance_getNumberOfGroupMembers()

t_status proc_instance_getNumberOfGroupMembers ( t_pid  pgid,
t_size number 
)

Obtain the number of process group members.

Parameters
[in]pgid- The process group id
[out]number- Number of process group members
Returns
Operation status

◆ proc_instance_getNumberOfSessionMembers()

t_status proc_instance_getNumberOfSessionMembers ( t_pid  sid,
t_size number 
)

Obtain the number of process session members.

Parameters
[in]sid- The session id
[out]number- Number of process group members
Returns
Operation status

◆ proc_instance_getState()

t_status proc_instance_getState ( t_pid  pid,
int *  state 
)

Obtain the state of a given process.

Parameters
[in]pid- Process ID to check
[out]state- The corresponding process state
Returns
Operation status

◆ proc_instance_getStatus()

t_status proc_instance_getStatus ( t_pid  pid,
t_proc_status *  status 
)

Obtain a status of a process.

Parameters
[in]pid- Process ID
[out]status- Status of child process
Returns
Operation status

◆ proc_instance_isRunning()

t_status proc_instance_isRunning ( t_pid  pid)

Is a process instance running.

Parameters
[in]pid- Process ID to check
Returns
SUCCESS (Running) / FAILURE

◆ proc_instance_suspendExecution()

t_status proc_instance_suspendExecution ( void  )

Suspend the execution of the current thread until an event occurs such as a signal in UNIX.

Returns
Operation status

◆ proc_instance_terminate()

OSAPI_NORETURN void proc_instance_terminate ( int  code)

Terminate the current process. It always succeeds.

Parameters
[in]code- Exit status code

◆ proc_library_getAllLoaded()

t_status proc_library_getAllLoaded ( t_size  maxlibs,
t_libinfo(*)  info[] 
)

Get a list of name and version information for each process loaded/shared library.

Parameters
[in]maxlibs- Maximum size of the return arrays, i.e. name and version
[out]info- Array with name and version of loaded libraries
Returns
Operation status

◆ proc_library_getNumberOfLoaded()

t_status proc_library_getNumberOfLoaded ( t_size maxlibs)

Get the number of shared libraries loaded in the process.

Parameters
[out]maxlibs- Number of currently loaded libraries
Returns
Operation status

◆ proc_library_getRelease()

t_status proc_library_getRelease ( const t_char name,
t_size  max,
char *  release 
)

Get the Release information of the named library.

Parameters
[in]name- Name of library to search
[in]max- Max. size of the output string
[out]release- The release version for the named library
Returns
Operation status

◆ proc_library_load()

t_status proc_library_load ( char *  path,
char *  options[],
t_library *  lib 
)

Load a library into the current process.

Parameters
[in]path- Path to the library
[in]options- C-String array with list of system specific options
[out]lib- library type
Returns
Operation status

◆ proc_library_supported()

t_status proc_library_supported ( void  )

Is the load/unload of libraries supported in the platform?

Returns
SUCCESS / FAILURE

◆ proc_library_unload()

t_status proc_library_unload ( t_library  lib)

Unload a library from the current process.

Parameters
[in]lib- library type
Returns
Operation status

◆ proc_list_allocate()

t_status proc_list_allocate ( t_size  nItems,
t_size  itemSize,
t_list list 
)

Allocate memory in the HEAP for a list of items The "list" is implemented as an array of bytes.

Parameters
[in]nItems- Number of items for the memory allocation
[in]itemSize- Size, in bytes, of each item
[out]list- List descriptor
Returns
Operation status

◆ proc_list_copy()

t_status proc_list_copy ( const t_list source,
t_list target 
)

Copy two list memories List cannot overlap in any way (this generates an error)

Parameters
[in]source- Address of the source list
[out]target- Address of the target/destination list
Returns
Operation status

◆ proc_list_copyFrom()

t_status proc_list_copyFrom ( const t_list source,
t_size  sourceItem,
t_size  targetSize,
void *  target 
)

Copy from a list item to a naked/raw memory location.

Parameters
[in]source- Address of the source buffer
[in]sourceItem- Item number to copy
[in]targetSize- Size of destination memory buffer
[out]target- Raw destination memory address
Returns
Operation status

◆ proc_list_copyTo()

t_status proc_list_copyTo ( const void *  source,
t_size  sourceSize,
t_size  targetItem,
t_list target 
)

Copy from a naked/raw memory into a list item.

Parameters
[in]source- Raw source memory address
[in]sourceSize- Size of the source memory content
[in]targetItem- Item number to copy into
[out]target- List descriptor
Returns
Operation status

◆ proc_list_deallocate()

t_status proc_list_deallocate ( t_list list)

Deallocate list.

Parameters
[in]list- List descriptor
Returns
Operation status

◆ proc_list_getCapacity()

t_status proc_list_getCapacity ( const t_list list,
t_size size 
)

Get the list capacity in terms of allocated items.

Parameters
[in]list- List descriptor
[out]size- List capacity
Returns
Operation status

◆ proc_list_getData()

t_status proc_list_getData ( const t_list list,
t_size  item,
void **  data 
)

Get the memory address of a given data item (of a list)

Parameters
[in]list- List descriptor
[in]item- Item number for which the address is needed
[out]data- Address of the managed naked/raw HEAP memory
Returns
Operation status

◆ proc_list_getRequiredCapacity()

t_status proc_list_getRequiredCapacity ( const t_list list,
t_size size 
)

Get the required list capacity in terms of allocated items The required capacity is needed in case a list is not big enough to hold all elements.

Parameters
[in]list- List descriptor
[out]size- List required capacity
Returns
Operation status

◆ proc_list_getSize()

t_status proc_list_getSize ( const t_list list,
t_size size 
)

Get the current list usage in terms of number of items.

Parameters
[in]list- List descriptor
[out]size- List usage size
Returns
Operation status

◆ proc_list_hasCapacity()

t_status proc_list_hasCapacity ( const t_list list,
t_size  size 
)

Check if the list can store N items.

Parameters
[in]list- List descriptor
[in]size- Required capacity from list
Returns
Success if enough capacity, error status otherwise

◆ proc_list_reAllocate()

t_status proc_list_reAllocate ( t_size  nItems,
t_list list 
)

Resize a list of items.

Parameters
[in]nItems- New number of items
[out]list- List descriptor
Returns
Operation status

◆ proc_list_setRequiredCapacity()

t_status proc_list_setRequiredCapacity ( t_size  size,
t_list list 
)

Set the current list required capacity The required capacity is needed in case a list is not big enough to hold all elements.

Parameters
[in]size- New list required capacity
[in,out]list- List descriptor
Returns
Operation status

◆ proc_list_setSize()

t_status proc_list_setSize ( t_size  size,
t_list list 
)

Set the current list usage.

Parameters
[in]size- New list usage size
[in,out]list- List descriptor
Returns
Operation status

◆ proc_memory_allocate()

t_status proc_memory_allocate ( t_size  size,
Byte  type,
t_memory mem 
)

Allocate memory in the process heap.

Parameters
[in]size- Required memory size in bytes
[in]type- How likely is the memory to be reallocated? Hint to the memory manager
[out]mem- Memory descriptor
Returns
Operation status

◆ proc_memory_copy()

t_status proc_memory_copy ( const t_memory source,
t_memory target 
)

Copy between two memories using memory descriptors.

Parameters
[in]source- Memory to be copied
[out]target- Destination of the copy
Returns
Operation status

◆ proc_memory_copyFrom()

t_status proc_memory_copyFrom ( const t_memory source,
t_size  targetSize,
void *  target 
)

Copy from a memory descriptor into a raw memory.

Parameters
[in]source- Memory to be copied
[in]targetSize- Size of the allocated memory destination
[out]target- Destination of the copy
Returns
Operation status

◆ proc_memory_copyTo()

t_status proc_memory_copyTo ( const void *  source,
t_size  sourceSize,
t_memory target 
)

Copy from a raw source memory into a memory descriptor.

Parameters
[in]source- Raw memory to be copied
[in]sourceSize- Size of the allocated source memory
[out]target- Destination of the copy
Returns
Operation status

◆ proc_memory_deallocate()

t_status proc_memory_deallocate ( t_memory location)

Deallocate a previously allocated heap memory block.

Parameters
[in]location- Address of the new memory block
Returns
Operation status

◆ proc_memory_getCapacity()

t_status proc_memory_getCapacity ( const t_memory mem,
t_size size 
)

Retrieve the total allocated memory size, in bytes.

Parameters
[in]mem- Memory descriptor
[out]size- Currently allocated memory size in bytes for the provided descriptor
Returns
Operation status

◆ proc_memory_getData()

t_status proc_memory_getData ( const t_memory mem,
void **  data 
)

Get the raw memory address for the given memory descriptor.

Parameters
[in]mem- Memory descriptor
[out]data- Raw memory address (data contents)
Returns
Operation status

◆ proc_memory_reAllocate()

t_status proc_memory_reAllocate ( t_size  newSize,
t_memory mem 
)

Resize the previously allocated memory in the process heap.

Parameters
[in]newSize- New memory size in bytes
[in,out]mem- Memory descriptor
Returns
Operation status

◆ proc_module_supported()

t_status proc_module_supported ( void  )

Is PROC module supported in the platform.

Returns
True if supported. False, otherwise (using status macros)

◆ proc_rawMemory_allocate()

t_status proc_rawMemory_allocate ( t_size  size,
Byte  type,
void *  mem 
)

Allocate memory in the process heap.

Parameters
[in]size- Required memory size in bytes
[in]type- How likely is the memory to be reallocated? Hint to the memory manager
[out]mem- Memory pointer
Returns
Operation status

◆ proc_rawMemory_deallocate()

t_status proc_rawMemory_deallocate ( void *  mem)

Deallocate a previously allocated heap memory block.

Parameters
[in]mem- Address of the memory to deallocate
Returns
Operation status

◆ proc_rawMemory_reAllocate()

t_status proc_rawMemory_reAllocate ( t_size  newSize,
void *  mem 
)

Resize the previously allocated memory in the process heap.

Parameters
[in]newSize- New memory size in bytes
[in,out]mem- Memory pointer
Returns
Operation status

◆ proc_resource_getCPU()

t_status proc_resource_getCPU ( t_pid  pid,
t_size size 
)

Get the process CPU consumption (summary of user and system)

Parameters
[in]pid- Process ID
[out]size- Percentage of consumed process CPU
Returns
Operation status
Here is the call graph for this function:

◆ proc_resource_getRealMemory()

t_status proc_resource_getRealMemory ( t_pid  pid,
t_size size 
)

Get the size of the process real memory, i.e. ram usage.

Parameters
[in]pid- Process ID
[out]size- Real memory size in bytes
Returns
Operation status
Here is the call graph for this function:

◆ proc_resource_getThreads()

t_status proc_resource_getThreads ( t_pid  pid,
t_size number 
)

Get the number of process kernel threads / LWPs.

Parameters
[in]pid- Process ID
[out]number- Number of process threads
Returns
Operation status
Here is the call graph for this function:

◆ proc_resource_getVirtualMemory()

t_status proc_resource_getVirtualMemory ( t_pid  pid,
t_size size 
)

Get the size of the process virtual memory.

Parameters
[in]pid- Process ID
[out]size- Virtual memory size in bytes
Returns
Operation status
Here is the call graph for this function:

◆ proc_signal_clearAll()

t_status proc_signal_clearAll ( void  )

Unblock of all signals. If there are any blocked signal, these will be unblocked.

Returns
Operation status

◆ proc_signal_getName()

t_status proc_signal_getName ( t_signal  sigNumber,
t_char **  sigName 
)

Get the name of a signal The function maps a signal number to a signal name.

Parameters
[in]sigNumber- The POSIX signal constant (e.g. SIG_TERM)
[out]sigName- The POSIX signal name (e.g. "SIG_TERM")
Returns
Operation status

◆ proc_signal_getNumber()

t_status proc_signal_getNumber ( t_char sigName,
t_signal *  sigNumber 
)

Get the name of a signal The function maps a signal number to a signal name.

Parameters
[in]sigName- The POSIX signal name (e.g. "SIG_TERM")
[out]sigNumber- The signal number
Returns
Operation status

◆ proc_signal_resetHandler()

t_status proc_signal_resetHandler ( t_signal  sigNumber)

Reset a signal to the default behavior.

Parameters
[in]sigNumber- The POSIX signal constant (e.g. SIG_TERM)
Returns
Operation status

◆ proc_signal_resetHandlerByName()

t_status proc_signal_resetHandlerByName ( t_char sigName)

Reset a signal to the default behavior.

Parameters
[in]sigName- The POSIX signal name (e.g. "SIG_TERM")
Returns
Operation status

◆ proc_signal_send()

t_status proc_signal_send ( t_pid  pid,
t_signal  sigNumber 
)

Send a signal to a process The signal identifier will be the standard POSIX constant SIG_xxx.

Parameters
[in]pid- Target Process ID
[out]sigNumber- Signal identifier
Returns
Operation status

◆ proc_signal_sendByName()

t_status proc_signal_sendByName ( t_pid  pid,
t_char sigName 
)

Send a signal to a process The signal identifier will be the standard POSIX name "SIG_xxx".

Parameters
[in]pid- Target Process ID
[out]sigName- Signal name
Returns
Operation status

◆ proc_signal_setHandler()

t_status proc_signal_setHandler ( t_signal  sigNumber,
t_sig_func  sigFunc 
)

Set a signal handler function for a given signal number.

Parameters
[in]sigNumber- The POSIX signal constant (e.g. SIG_TERM)
[out]sigFunc- The function name/address
Returns
Operation status

◆ proc_signal_setHandlerByName()

t_status proc_signal_setHandlerByName ( t_char sigName,
t_sig_func  sigFunc 
)

Set a signal handler function for a given signal name.

Parameters
[in]sigName- The POSIX signal name (e.g. "SIG_TERM")
[out]sigFunc- The function name/address
Returns
Operation status

◆ proc_signal_supported()

t_status proc_signal_supported ( int *  supportLevel)

Are signals supported by the OSAPI library?

Parameters
[out]supportLevel- The level of support may vary, for instance, standard POSIX signals may be supported but not real time signals.
Returns
Operation status

◆ proc_time_getStart()

t_status proc_time_getStart ( t_pid  pid,
t_time start 
)

Get the start time of a process.

Parameters
[in]pid- Process ID
[out]start- Process start time
Returns
Operation status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ proc_uid_get()

t_status proc_uid_get ( t_upid upid)

Get the current process Unique ID A Process Unique ID is a unique incarnation of a process instance, i.e. no two processes will have the same UPID in the same node.

Parameters
[out]upid- The process Unique ID
Returns
Operation status
Here is the call graph for this function: