DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
Wrapper for process manipulation. More...
#include <Process.hpp>
Public Member Functions | |
Process () | |
Builds a process representing the current process. | |
Process (const Process &other) | |
copy constructor | |
Process (pid_t pid) | |
Builds a process with process id pid . | |
Process (pid_t pid, const std::string &name) | |
Builds a process with process id and process name. | |
~Process () throw () | |
Destructor | |
operator pid_t () const throw () | |
Cast operator to pid. | |
int | join (bool throw_non_zero=false) const |
Waits for the process to terminate. | |
void | signal (int signal) const |
Sends a signal to the process. | |
bool | exists () const |
Does the process exist? | |
bool | equals (const Process &other) const throw () |
Comparison method. | |
void | terminate () const |
Terminate the process. | |
pid_t | process_id () const throw () |
the id of the process | |
std::string | to_string () const throw () |
String conversion method. | |
Static Public Member Functions | |
static const char * | exit_text (int return_value) |
the textual description of standard exit codes | |
static std::string | exit_pretty (int return_value) |
static const Process * | instance () throw () |
static void | set_name (const std::string &name) throw () |
Protected Attributes | |
pid_t | m_process_id |
process identifier | |
std::string | m_process_name |
process name - only to be used for display | |
Static Protected Attributes | |
static const char *const | SYS_EXITS_NAMES [] |
names for standard system exit values | |
static const char *const | TEST_EXITS_NAMES [] = { "undefined test", "test failed", "test unresolved", "test untested", "unsupported test" } |
names for testing exit values | |
static const char *const | OK_EXIT_NAME = "ok" |
string to describe 0 exit value | |
static const char *const | SIGNAL_EXIT_NAME |
string to describe signal exited value | |
static const int | TEST_BASE_VALUE = 182 |
first value for test manager exit codes | |
static const int | TEST_MAX_VALUE = 186 |
last value for test manager exit codes | |
static const int | TERMINATION_WAIT = 100000 |
wait time before deciding a termination signal did not work | |
static Process * | s_instance = 0 |
singleton instance | |
Wrapper for process manipulation.
This class represents a process It offers basic methods to manipulate a process
Definition at line 25 of file Process.hpp.
OksSystem::Process::Process | ( | ) |
Builds a process representing the current process.
Constructor from current process For the current process, the singleton factory method instance
should be used
Definition at line 93 of file Process.cpp.
OksSystem::Process::Process | ( | const Process & | other | ) |
copy constructor
Copy constructor
other | original instance |
Definition at line 101 of file Process.cpp.
OksSystem::Process::Process | ( | pid_t | id | ) |
Builds a process with process id pid
.
Constructor for pid
id | pid of the process |
Definition at line 110 of file Process.cpp.
OksSystem::Process::Process | ( | pid_t | id, |
const std::string & | name ) |
Builds a process with process id and process name.
Constructor from pid and process name
id | pid of the process |
name | display name of the process |
Definition at line 119 of file Process.cpp.
OksSystem::Process::~Process | ( | ) | ||||
throw | ( | ) |
bool OksSystem::Process::equals | ( | const Process & | other | ) | const | |
throw | ( | ) |
Comparison method.
Checks if two process are equal
other | the process to compare this process to |
Definition at line 193 of file Process.cpp.
bool OksSystem::Process::exists | ( | ) | const |
Does the process exist?
Checks if the process actually exists on the host
Definition at line 183 of file Process.cpp.
|
static |
Builds a pretty string for an exit value
return_value | the integer returned by a program |
exit_text
, this text and the number between parenthesis if not, the return_value
converter into a string Definition at line 55 of file Process.cpp.
|
static |
the textual description of standard exit codes
Gives textual representation of exit values. This method recognises return codes from sysexits
and the values returned by the text-manager
return_value | the integer returned by a program |
Definition at line 42 of file Process.cpp.
|
static |
Default current process instance If needed the instance is created
Definition at line 72 of file Process.cpp.
int OksSystem::Process::join | ( | bool | throw_non_zero = false | ) | const |
Waits for the process to terminate.
Waits for a process to terminate. If the process terminates normally, the return value is the termination status of the process. If the process stops or is signaled, an SignalIssue is thrown.
Definition at line 146 of file Process.cpp.
OksSystem::Process::operator pid_t | ( | ) | const | |||
throw | ( | ) |
Cast operator to pid.
Cast operator - converts to process-id
Definition at line 135 of file Process.cpp.
pid_t OksSystem::Process::process_id | ( | ) | const | |||
throw | ( | ) |
the id of the process
Definition at line 244 of file Process.cpp.
|
static |
Sets the process name of the current process
Definition at line 83 of file Process.cpp.
void OksSystem::Process::signal | ( | int | signal_number | ) | const |
Sends a signal to the process.
Sends a signal to the process
signal_number | number of the signal |
Definition at line 169 of file Process.cpp.
void OksSystem::Process::terminate | ( | ) | const |
Terminate the process.
Terminates a process Termination is implemented by
Definition at line 202 of file Process.cpp.
std::string OksSystem::Process::to_string | ( | ) | const | |||
throw | ( | ) |
String conversion method.
Builds a string description of the process
Definition at line 232 of file Process.cpp.
|
protected |
process identifier
Definition at line 27 of file Process.hpp.
|
protected |
process name - only to be used for display
Definition at line 28 of file Process.hpp.
|
staticprotected |
string to describe 0 exit value
Definition at line 31 of file Process.hpp.
|
staticprotected |
singleton instance
Definition at line 36 of file Process.hpp.
|
staticprotected |
string to describe signal exited value
Definition at line 32 of file Process.hpp.
|
staticprotected |
names for standard system exit values
Definition at line 29 of file Process.hpp.
|
staticprotected |
wait time before deciding a termination signal did not work
Wait time before deciding a termination signal did not work (in nanoseconds)
Definition at line 35 of file Process.hpp.
|
staticprotected |
first value for test manager exit codes
Lowest value for test manager result code
Definition at line 33 of file Process.hpp.
|
staticprotected |
names for testing exit values
Definition at line 31 of file Process.hpp.
|
staticprotected |
last value for test manager exit codes
Highest value for test manager result code
Definition at line 34 of file Process.hpp.