10 #include <sys/types.h> 11 #include <sys/utsname.h> 24 ::sprintf( fname,
"/proc/%d/cmdline", ::getpid() );
25 FILE* cmdLine = ::fopen( fname,
"r" );
33 long len = ::fread( cmd,
sizeof(
char ),
sizeof( cmd ), cmdLine );
36 for (
char* token = cmd; token - cmd < len; token += ::strlen( token ) + 1 ) { result.
push_back( token ); }
49 abi::__cxa_demangle( class_name,
nullptr,
nullptr, &status ),
std::free );
50 if ( !realname )
return class_name;
54 "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >( (?=>))?"};
66 static const size_t STRING_SIZE = 512;
68 if ( ::gethostname( hname.
data(), STRING_SIZE ) ) {
return ""; }
86 if ( ::uname( &ut ) ) {
return "UNKNOWN Linux"; }
93 if ( ::uname( &ut ) ) {
return "UNKNOWN version"; }
100 if ( ::uname( &ut ) ) {
return "UNKNOWN"; }
106 const char* acct = ::getlogin();
107 if ( !acct ) acct = ::getenv(
"LOGNAME" );
108 if ( !acct ) acct = ::getenv(
"USER" );
110 return ( acct ? acct :
"UNKNOWN" );
std::string osVersion()
Get the operating system's version.
std::string accountName()
Get the account name of the current user.
std::string machineType()
Get the runner machine's type.
Note: OS specific details for environment resolution.
std::string typeinfoName(const char *class_name)
Get the human readable type name from a typeinfo name.
std::vector< std::string > cmdLineArgs()
Get the command line arguments of the process.
std::string hostName()
Get the system's host name.
T regex_replace(T...args)
std::string osName()
Get the operating system's name.