xentara-utils v1.2.1
Xentara utilities library
Loading...
Searching...
No Matches
xentara::utils::system Namespace Reference

System related functionality. More...

Classes

class  SystemInfo
 This class can be used to access some real-time relevant properties of the system. More...
 

Typedefs

using Pid = unsigned long
 The type used by the operating system to represent PIDs.
 

Enumerations

enum  UserNameType { UserName , DisplayName , PrincipalName , QualifiedName }
 String formats for user names. More...
 

Functions

auto pid () noexcept -> Pid
 Gets the PID of the calling process.
 
auto userName (UserNameType type=UserNameType::UserName) -> std::string
 Gets the current user name.
 

Detailed Description

System related functionality.

This namespace contains system introspection functionality.

Typedef Documentation

◆ Pid

using xentara::utils::system::Pid = typedef unsigned long

The type used by the operating system to represent PIDs.

This is a DWORD under Windows, and a pid_t everywhere else.

Enumeration Type Documentation

◆ UserNameType

String formats for user names.

Enumerator
UserName 

The regular user name of the user.

Under Windows, this is the plain user name of the user, without the computer or domain name prefix.

Under Linux, this is the regular user name as configured in the system. If the user ID does not correspond
to a configured user, a placeholder name containing the user ID is returned instead. 
DisplayName 

The display name of the user.

Under Windows, this is the display name of the user, which is usually the user’s full name (first and last name). If the
user has no display name, then the regular user name is returned.

Under Linux, this is the same as UserNameType::UserName. 
PrincipalName 

The principal name of the user.

Under Windows, this is the "pricipal" name of the user, which is usually the user’s email address. If the
user has no pricipal name, then the qualified name of the user as described under UserNameType::QualifiedName
is returned instead.

Under Linux, this is the same as UserNameType::UserName. 
QualifiedName 

The user name of the user, prefixed by the computer or domain name.

Under Windows, this is the name of the user in the form “COMPUTER_OR_DOMAIN_NAME\UserName”.

Under Linux, this is the same as UserNameType::UserName. 

Function Documentation

◆ pid()

auto xentara::utils::system::pid ( ) -> Pid
noexcept

Gets the PID of the calling process.

◆ userName()

auto xentara::utils::system::userName ( UserNameType  type = UserNameType::UserName) -> std::string

Gets the current user name.

This function returns user name of the effective user. Normally, the effective user is the the user under which the calling ptocess is running. However, the effective user can be change by the application:

  • On Posix platforms, the effective user can be changed using the seteuid(2) command.
  • Under Windows, the effective user can be changed using Client Impersonation.
    Parameters
    typeThe type of user name to return.
    Returns
    The user name.