Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

process_control.h File Reference

Process control. More...

Go to the source code of this file.

Functions


Detailed Description

Process control.

This module contains functions for process control and control statistics. The process control operates on an array of processes, which is assigned by process_control_init().

The process control is designed to run as a pth thread. The thread, process_control_update_thread(), gathers process and CPU information from the system, and then checks if processes are in their required states and stops or restarts processes if necessary.


Function Documentation

int process_control_acquire_mutex  ) 
 

Acquire a mutex for process control.

Before a process control function is called from an external module, it is necessary to lock the process control. If one thread acquires a mutex, it is locked by this thread and must be released to let other processes access. The correct handling of locking/unlocking the process control is left to the client. Process control functions do not lock or unlock resources internally.

Returns:
1 if mutex could be acquired, 0 if mutex is locked.

void process_control_close_all  ) 
 

Emergency exit.

Sends terminate and kill signals to all controlled processes.

void process_control_initialize Array procArray  ) 
 

Initializes the process control.

Parameters:
procArray Process array.
Assigns an array of processes to the process control. Initializes mutex and statistics.

Note:
pth_init() has to be called before this function!

void process_control_notify_termination pid_t  pid  ) 
 

Notifies the termination of a process.

When a process terminates, its parent process receives a CHILD signal. The signal handler calls this function to tell the process control that a process has terminated.

void process_control_print_list int  fd  ) 
 

Print a process list to a file descriptor.

Parameters:
fd A file descriptor
This function prints a process list in tabular form. It is used for the "ls" interpreter command.

void process_control_print_statistics int  fd  ) 
 

Prints statistics output to a file descriptor, using pth_write.

Parameters:
fd File descriptor

void process_control_reset_process_statistics char **  tags,
int  nTags
 

Resets the process statistics of a list of processes.

Parameters:
tags Pointer to a string array which contains the process tags.
nTags lenght of tags.

void process_control_shutdown_all_processes  ) 
 

Stops all processes in reverse starting order.

Stops all processes in the process array. Sends a TERM signal, waits for the process to stop, possibly sends a KILL signal after the process's term_duration.

void process_control_shutdown_processes char **  tags,
int  nTags
 

Stops processes in reverse starting order.

Parameters:
tags Pointer to a string array which contains the process tags.
nTags lenght of tags.

void process_control_start_all_processes int  execInit  ) 
 

Starts all processes.

Parameters:
execInit Execute the process's init script before restart.
Starts all processes in the process array.

void process_control_start_processes char **  tags,
int  nTags,
int  execInit
 

Starts a list of processes identified by their tags.

Parameters:
tags Pointer to a string array which contains the process tags.
nTags lenght of tags.
execInit Execute the process's init script before restart.

void process_control_stop_all_processes  ) 
 

Stops all processes.

Stops all processes in the process array.

void* process_control_update_thread void *  arg  ) 
 

Process information update thread.

Calls process_control_update() periodically.


Generated on Fri Jan 20 10:12:18 2006 by  doxygen 1.4.2