18#include <sys/utsname.h>
28 ::snprintf( fname,
sizeof( fname ),
"/proc/%d/cmdline", ::getpid() );
29 FILE* cmdLine = ::fopen( fname,
"r" );
32 std::vector<std::string> result;
37 long len = ::fread( cmd,
sizeof(
char ),
sizeof( cmd ), cmdLine );
40 for (
char* token = cmd; token - cmd < len; token += ::strlen( token ) + 1 ) { result.push_back( token ); }
52 static const size_t STRING_SIZE = 512;
53 std::array<char, STRING_SIZE> hname;
54 if ( ::gethostname( hname.data(), STRING_SIZE ) ) {
return ""; }
66 return std::string( hname.data() );
72 if ( ::uname( &ut ) ) {
return "UNKNOWN Linux"; }
73 return std::string( ut.sysname );
79 if ( ::uname( &ut ) ) {
return "UNKNOWN version"; }
80 return std::string( ut.release );
86 if ( ::uname( &ut ) ) {
return "UNKNOWN"; }
87 return std::string( ut.machine );
92 const char* acct = ::getlogin();
93 if ( !acct ) acct = ::getenv(
"LOGNAME" );
94 if ( !acct ) acct = ::getenv(
"USER" );
96 return ( acct ? acct :
"UNKNOWN" );
std::string normalizeTypeName(const char *mangled_name, bool normalize_commas=false)
Normalize a demangled C++ type name for cross-platform consistency.
Namespace holding Linux specific functions.
std::string typeinfoName(const char *class_name)
Get the human readable type name from a typeinfo name.
std::string accountName()
Get the account name of the current user.
std::vector< std::string > cmdLineArgs()
Get the command line arguments of the process.
std::string machineType()
Get the runner machine's type.
std::string osVersion()
Get the operating system's version.
std::string osName()
Get the operating system's name.
std::string hostName()
Get the system's host name.
Note: OS specific details for environment resolution.