ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::system::ProcessInfo Class Reference

Description:

This class represents process information.

Definition at line 13 of file processinfo.inl.

Collaboration diagram for alib::system::ProcessInfo:
[legend]

Public Static Method Index:

static ALIB_DLL const ProcessInfoCurrent ()
 

Public Field Index:

AString CmdLine
 The command line which invoked this process.
 
AString ConsoleTitle
 For console processes, this is the title displayed in the title bar. (Windows OS only.)
 
AString ExecFileName
 
AString ExecFilePath
 The path of the executable (if available to us).
 
AString Name
 
uinteger PID
 The process id as AString.
 
uinteger PPID
 The parent's process id as AString. (Unix like OS / Mac OS only.)
 
AString Stat
 The contents of /proc/PID/stat file. (Unix like OS only.)
 
AString StatPGRP
 The process group field (4) within Stat. (Unix like OS only.)
 
AString StatState
 The state field (2) within Stat. (Unix like OS only.)
 

Public Method Index:

 ProcessInfo (uinteger processID)
 
ALIB_DLL bool Get (uinteger processID)
 

Protected Static Field Index:

static ALIB_DLL ProcessInfo current
 

Protected Method Index:

 ProcessInfo ()
 Default constructor to create an empty instance.
 
ALIB_DLL bool get (uinteger PID)
 
bool getStatField (int fieldNo, AString &target)
 

Field Details:

◆ CmdLine

AString alib::system::ProcessInfo::CmdLine

The command line which invoked this process.

Definition at line 28 of file processinfo.inl.

◆ ConsoleTitle

AString alib::system::ProcessInfo::ConsoleTitle

For console processes, this is the title displayed in the title bar. (Windows OS only.)

Definition at line 74 of file processinfo.inl.

◆ current

ProcessInfo alib::system::ProcessInfo::current
staticprotected

Information on the current process. This is initialized once, with the first invocation of Current.

Definition at line 21 of file processinfo.inl.

◆ ExecFileName

AString alib::system::ProcessInfo::ExecFileName

The file name of the executable (excluding ExecFilePath). Under GNU/Linux, if we have no access to read that value, field ExecFilePath will be empty while this field is filled with Name.

Definition at line 40 of file processinfo.inl.

◆ ExecFilePath

AString alib::system::ProcessInfo::ExecFilePath

The path of the executable (if available to us).

Definition at line 35 of file processinfo.inl.

◆ Name

AString alib::system::ProcessInfo::Name

The name of the process.
Under GNU/Linux this is read from /proc/nnn/stat and may differ from ExecFileName. Under Windows OS, it is he same as field ExecFileName.

Definition at line 32 of file processinfo.inl.

◆ PID

uinteger alib::system::ProcessInfo::PID

The process id as AString.

Definition at line 25 of file processinfo.inl.

◆ PPID

uinteger alib::system::ProcessInfo::PPID

The parent's process id as AString. (Unix like OS / Mac OS only.)

Definition at line 48 of file processinfo.inl.

◆ Stat

AString alib::system::ProcessInfo::Stat

The contents of /proc/PID/stat file. (Unix like OS only.)

Definition at line 51 of file processinfo.inl.

◆ StatPGRP

AString alib::system::ProcessInfo::StatPGRP

The process group field (4) within Stat. (Unix like OS only.)

Definition at line 57 of file processinfo.inl.

◆ StatState

AString alib::system::ProcessInfo::StatState

The state field (2) within Stat. (Unix like OS only.)

Definition at line 54 of file processinfo.inl.

Constructor(s) / Destructor Details:

◆ ProcessInfo() [1/2]

alib::system::ProcessInfo::ProcessInfo ( )
inlineprotected

Default constructor to create an empty instance.

Definition at line 85 of file processinfo.inl.

◆ ProcessInfo() [2/2]

alib::system::ProcessInfo::ProcessInfo ( uinteger processID)
inline

Constructor that initializes this instance according to the process information received from the system.

Note
This method is implemented for Unix like OS (incl. Mac OS) only. On Windows OS, only information about the current process can be received using static method Current.
Parameters
processIDThe ID of the process information is requested on. If a nulled string is provided, the current process is addressed.

Definition at line 126 of file processinfo.inl.

Here is the call graph for this function:

Method Details:

◆ Current()

const ProcessInfo & alib::system::ProcessInfo::Current ( )
static

Static method that receives information on the current process.

Returns
A constant reference to a ProcessInfo object representing the current process.

Definition at line 56 of file processinfo.cpp.

Here is the call graph for this function:

◆ Get()

ALIB_DLL bool alib::system::ProcessInfo::Get ( uinteger processID)
inline

Fills the fields of this instance according to the process information received from the system.

Note
This method is implemented for Unix like OS (incl. Mac OS) only. On Windows OS, only information about the current process can be received using static method Current.
Parameters
processIDThe ID of the process information is requested on. If a nulled string is provided, the current process is addressed.
Returns
true on success, false otherwise.

Definition at line 143 of file processinfo.inl.

Here is the call graph for this function:

◆ get()

bool alib::system::ProcessInfo::get ( uinteger PID)
protected

Internal get() method with different platform implementations.

Parameters
PIDThe ID of the process information is requested on. If a nulled string is provided, the current process is addressed.
Returns
true on success, false otherwise.

Definition at line 213 of file processinfo.cpp.

◆ getStatField()

bool alib::system::ProcessInfo::getStatField ( int fieldNo,
AString & target )
protected

Reads a field from the data found in /proc/PID/stat.

Parameters
fieldNoThe field number to read
targetThe variable to store the result in
Returns
true if successful.

The documentation for this class was generated from the following files: