RSC  0.16.0
Process Information Functions

These functions are not guaranteed to be either thread-safe or reentrant. More...

Typedefs

typedef unsigned int rsc::os::PID
 

Functions

PID rsc::os::currentProcessId ()
 Return the id the current process. More...
 
std::string rsc::os::getProgramName (PID pid)
 Return the name of the program executed in the process designated by pid. More...
 
std::string rsc::os::currentProgramName ()
 Return the name of the program executed in the current process. More...
 
std::string rsc::os::getExecutablePath (PID pid)
 Return the absolute path of the executable file that is executed in the process designated by pid. More...
 
std::string rsc::os::currentExecutablePath ()
 Return the absolute path of the executable file that is executed in the current process. More...
 
std::vector< std::string > rsc::os::getCommandlineArguments (PID pid)
 Return the list of commandline arguments of the process designated by pid. More...
 
std::vector< std::string > rsc::os::currentCommandlineArguments ()
 Return the list of commandline arguments of the current process. More...
 
boost::posix_time::ptime rsc::os::getProcessStartTime (PID pid)
 Return the start time of the process designated by pid. More...
 
boost::posix_time::ptime rsc::os::currentProcessStartTime ()
 Return the start time of the current process. More...
 
std::string rsc::os::getExecutingUser (PID pid)
 Return login- or account-name of the user executing pid. More...
 
std::string rsc::os::currentExecutingUser ()
 Return the login- or account-name of the user executing the current process. More...
 

Detailed Description

These functions are not guaranteed to be either thread-safe or reentrant.

Typedef Documentation

typedef unsigned int rsc::os::PID

Definition at line 47 of file ProcessInfo.h.

Function Documentation

std::vector< std::string > rsc::os::currentCommandlineArguments ( )

Return the list of commandline arguments of the current process.

Returns
std::vector containing the commandline arguments of the current process.
Exceptions
std::runtime_errorIf the commandline arguments cannot be determined.

Definition at line 147 of file LinuxProcessInfo.cpp.

References rsc::os::currentProcessId(), and rsc::os::getCommandlineArguments().

Referenced by rsc::os::DeleteHandle::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string rsc::os::currentExecutablePath ( )

Return the absolute path of the executable file that is executed in the current process.

Returns
The absolute path of the executable.
Exceptions
std::runtime_errorIf the executable path cannot be determined.

Definition at line 124 of file LinuxProcessInfo.cpp.

References rsc::os::currentProcessId(), and rsc::os::getExecutablePath().

Here is the call graph for this function:

std::string rsc::os::currentExecutingUser ( )

Return the login- or account-name of the user executing the current process.

Returns
the login- or account-name of the user executing the current process.
Exceptions
std::runtime_errorIf determining the executing user fails.

Definition at line 231 of file LinuxProcessInfo.cpp.

References rsc::os::uidToName().

Referenced by rsc::os::DeleteHandle::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:

PID rsc::os::currentProcessId ( )

Return the id the current process.

Returns
The id of the current process.
Exceptions
std::runtime_errorIf the process id cannot be determined.

Definition at line 55 of file LinuxProcessInfo.cpp.

Referenced by rsc::os::currentCommandlineArguments(), rsc::os::currentExecutablePath(), rsc::os::currentProcessStartTime(), rsc::os::currentProgramName(), and rsc::os::DeleteHandle::operator()().

Here is the caller graph for this function:

boost::posix_time::ptime rsc::os::currentProcessStartTime ( )

Return the start time of the current process.

The precision with which the start time can be determined varies between platforms.

Returns
boost::posix_time::ptime encoding the start time of the process.
Exceptions
std::runtime_errorIf determining the start time fails.

Definition at line 199 of file LinuxProcessInfo.cpp.

References rsc::os::currentProcessId(), and rsc::os::getProcessStartTime().

Referenced by rsc::os::DeleteHandle::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string rsc::os::currentProgramName ( )

Return the name of the program executed in the current process.

Returns
Name of the program executed in the current process.
Exceptions
std::runtime_errorIf the program name cannot be determined.

Definition at line 105 of file LinuxProcessInfo.cpp.

References rsc::os::currentProcessId(), and rsc::os::getProgramName().

Here is the call graph for this function:

std::vector< std::string > rsc::os::getCommandlineArguments ( PID  pid)

Return the list of commandline arguments of the process designated by pid.

Parameters
pidThe id of the process for which the program name should be returned.
Returns
std::vector containing the commandline arguments of the process with the given pid.
Exceptions
std::runtime_errorIf the commandline arguments cannot be determined.

Definition at line 128 of file LinuxProcessInfo.cpp.

References rsc::os::getCommandlineComponents().

Referenced by rsc::os::currentCommandlineArguments(), and rsc::os::DeleteHandle::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string rsc::os::getExecutablePath ( PID  pid)

Return the absolute path of the executable file that is executed in the process designated by pid.

Parameters
pidThe id of the process for which the program name should be returned.
Returns
The absolute path of the executable.
Exceptions
std::runtime_errorIf the executable path cannot be determined.

Definition at line 109 of file LinuxProcessInfo.cpp.

References rsc::os::getProgramName(), and rsc::os::procFilename().

Referenced by rsc::os::currentExecutablePath().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string rsc::os::getExecutingUser ( PID  pid)

Return login- or account-name of the user executing pid.

Parameters
pidThe id of the process for which the executing user should be returned.
Returns
The login- or account-name of the user executing the process.
Exceptions
std::runtime_errorIf determining the executing user fails.

Definition at line 209 of file LinuxProcessInfo.cpp.

References rsc::os::procFilename(), and rsc::os::uidToName().

Referenced by rsc::os::DeleteHandle::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:

boost::posix_time::ptime rsc::os::getProcessStartTime ( PID  pid)

Return the start time of the process designated by pid.

The precision with which the start time can be determined varies between platforms.

Parameters
pidThe id of the process for which the start time should be returned.
Returns
boost::posix_time::ptime encoding the start time of the process.
Exceptions
std::runtime_errorIf determining the start time fails.

Definition at line 157 of file LinuxProcessInfo.cpp.

References rsc::os::currentBootTime(), and rsc::os::procFilename().

Referenced by rsc::os::currentProcessStartTime(), and rsc::os::DeleteHandle::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string rsc::os::getProgramName ( PID  pid)

Return the name of the program executed in the process designated by pid.

Parameters
pidThe id of the process for which the program name should be returned.
Returns
Name of the program executed in the process with the given pid.
Exceptions
std::runtime_errorIf the program name cannot be determined.

Definition at line 89 of file LinuxProcessInfo.cpp.

References rsc::os::getCommandlineComponents().

Referenced by rsc::os::currentProgramName(), and rsc::os::getExecutablePath().

Here is the call graph for this function:

Here is the caller graph for this function: