DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Process.hpp
Go to the documentation of this file.
1// DUNE DAQ modification notice:
2// This file has been modified from the original ATLAS system source for the DUNE DAQ project.
3// Fork baseline commit: system-00-00-20 (2020-09-25).
4// Renamed since fork: yes (from system/Process.h to include/okssystem/Process.hpp).
5
6/*
7 * Process.h
8 * OksSystem
9 *
10 * Created by Matthias Wiesmann on 18.01.05.
11 * Copyright 2005 CERN. All rights reserved.
12 *
13 */
14
15#ifndef OKSSYSTEM_PROCESS
16#define OKSSYSTEM_PROCESS
17
18#include <sys/types.h>
19#include <string>
20
21namespace OksSystem {
22
29
30 class Process {
31protected:
32 pid_t m_process_id ;
33 std::string m_process_name ;
34 static const char* const SYS_EXITS_NAMES[] ;
35 static const char* const TEST_EXITS_NAMES[] ;
36 static const char* const OK_EXIT_NAME ;
37 static const char* const SIGNAL_EXIT_NAME ;
38 static const int TEST_BASE_VALUE ;
39 static const int TEST_MAX_VALUE ;
40 static const int TERMINATION_WAIT ;
42public:
43 static const char* exit_text(int return_value) ;
44 static std::string exit_pretty(int return_value) ;
45 static const Process *instance() throw() ;
46 static void set_name(const std::string &name) throw() ;
47 Process();
48 Process(const Process &other) ;
49 Process(pid_t pid) ;
50 Process(pid_t pid, const std::string &name);
51 ~Process() throw() ;
52 operator pid_t() const throw() ;
53 int join(bool throw_non_zero=false) const ;
54 void signal(int signal) const ;
55 bool exists() const ;
56 bool equals(const Process &other) const throw() ;
57 void terminate() const ;
58 pid_t process_id() const throw();
59 std::string to_string() const throw();
60 } ; // Process
61
62} // OksSystem
63
64std::ostream& operator<<(std::ostream& stream, const OksSystem::Process &proc) ;
65bool operator ==(const OksSystem::Process &a, const OksSystem::Process &b) throw();
66bool operator !=(const OksSystem::Process &a, const OksSystem::Process &b) throw();
67
68#endif
static const int TERMINATION_WAIT
wait time before deciding a termination signal did not work
Definition Process.hpp:40
static const Process * instance()
Definition Process.cpp:77
static const char *const OK_EXIT_NAME
string to describe 0 exit value
Definition Process.hpp:36
static const char * exit_text(int return_value)
the textual description of standard exit codes
Definition Process.cpp:47
int join(bool throw_non_zero=false) const
Waits for the process to terminate.
Definition Process.cpp:151
static const char *const SIGNAL_EXIT_NAME
string to describe signal exited value
Definition Process.hpp:37
bool equals(const Process &other) const
Comparison method.
Definition Process.cpp:198
static const int TEST_BASE_VALUE
first value for test manager exit codes
Definition Process.hpp:38
void signal(int signal) const
Sends a signal to the process.
Definition Process.cpp:174
pid_t m_process_id
process identifier
Definition Process.hpp:32
void terminate() const
Terminate the process.
Definition Process.cpp:207
static const char *const SYS_EXITS_NAMES[]
names for standard system exit values
Definition Process.hpp:34
static void set_name(const std::string &name)
Definition Process.cpp:88
static const int TEST_MAX_VALUE
last value for test manager exit codes
Definition Process.hpp:39
static std::string exit_pretty(int return_value)
Definition Process.cpp:60
bool exists() const
Does the process exist?
Definition Process.cpp:188
static const char *const TEST_EXITS_NAMES[]
names for testing exit values
Definition Process.hpp:36
pid_t process_id() const
the id of the process
Definition Process.cpp:249
static Process * s_instance
singleton instance
Definition Process.hpp:41
std::string m_process_name
process name - only to be used for display
Definition Process.hpp:33
Process()
Builds a process representing the current process.
Definition Process.cpp:98
std::string to_string() const
String conversion method.
Definition Process.cpp:237