| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

System.cpp
Go to the documentation of this file.
1 //====================================================================
2 // System.cpp
3 //--------------------------------------------------------------------
4 //
5 // Package : System (The LHCb System service)
6 //
7 // Description: Implementation of Systems internals
8 //
9 // Author : M.Frank
10 // Created : 13/1/99
11 // Changes :
12 //====================================================================
13 #define SYSTEM_SYSTEM_CPP
14 #include <ctime>
15 #include <cstring>
16 #include <cstdlib>
17 #include <iomanip>
18 #include <iostream>
19 #include <sstream>
20 #include <typeinfo>
21 #include <memory>
22 #include <regex>
23 #include <array>
24
25 #include "GaudiKernel/System.h"
26 #include "instrset.h"
27
28 #ifdef _WIN32
29 #define strcasecmp _stricmp
30 #define strncasecmp _strnicmp
31 #define getpid _getpid
32 #define NOMSG
33 #define NOGDI
34 #include "process.h"
35 #include "windows.h"
36 #undef NOMSG
37 #undef NOGDI
38 static const char* SHLIB_SUFFIX = ".dll";
39 #else // UNIX...: first the EGCS stuff, then the OS dependent includes
40 static const char* SHLIB_SUFFIX = ".so";
41 #include <errno.h>
42 #include <string.h>
43 #include "sys/times.h"
44 #include "unistd.h"
45 #include "libgen.h"
46 #include <cstdio>
47 #include <cxxabi.h>
48 #if defined(__linux) || defined(__APPLE__)
49 #include "dlfcn.h"
50 #include <sys/utsname.h>
51 #include <unistd.h>
52 #elif __hpux
53 #include "dl.h"
54 struct HMODULE {
55 shl_descriptor dsc;
56 long numSym;
57 shl_symbol* sym;
58 };
59 #endif
60
61 #endif
62
63 // Note: __attribute__ is a GCC keyword available since GCC 3.4
64 #ifdef __GNUC__
65 # if __GNUC__ < 3 || \
66 (__GNUC__ == 3 && (__GNUC_MINOR__ < 4 ))
67 // GCC < 3.4
68 # define __attribute__(x)
69 # endif
70 #else
71 // non-GCC
72 # define __attribute__(x)
73 #endif
74
75 static std::vector<std::string> s_argvStrings;
76 static std::vector<const char*> s_argvChars;
77
78 static unsigned long doLoad(const std::string& name, System::ImageHandle* handle) {
79 #ifdef _WIN32
80 void* mh = ::LoadLibrary( name.length() == 0 ? System::exeName().c_str() : name.c_str());
81 *handle = mh;
82 #else
83 const char* path = name.c_str();
84 #if defined(__linux) || defined(__APPLE__)
85 void *mh = ::dlopen(name.length() == 0 ? nullptr : path, RTLD_LAZY | RTLD_GLOBAL);
86 *handle = mh;
87 #elif __hpux
88 shl_t mh = ::shl_load(name.length() == 0 ? 0 : path, BIND_IMMEDIATE | BIND_VERBOSE, 0);
89 HMODULE* mod = new HMODULE;
90 if ( 0 != mh ) {
91 if ( 0 != ::shl_gethandle_r(mh, &mod->dsc) ) {
92 std::cout << "System::loadDynamicLib>" << ::strerror(getLastError()) << std::endl;
93 }
94 else {
95 typedef void* (*___all)();
96 ___all _alloc = (___all)malloc;
97 mod->numSym = ::shl_getsymbols(mod->dsc.handle, TYPE_PROCEDURE, EXPORT_SYMBOLS, malloc, &mod->sym);
98 *handle = mod;
99 }
100 }
101 #endif
102 #endif
103 if ( ! *handle ) {
104 return System::getLastError();
105 }
106 return 1;
107 }
108
109 static unsigned long loadWithoutEnvironment(const std::string& name, System::ImageHandle* handle) {
110
111 std::string dllName = name;
112 long len = strlen(SHLIB_SUFFIX);
113
114 // Add the suffix at the end of the library name only if necessary
115 // FIXME: cure the logic
116 if ((dllName.length() != 0) &&
117 ::strncasecmp(dllName.data()+dllName.length()-len, SHLIB_SUFFIX, len) != 0) {
118 dllName += SHLIB_SUFFIX;
119 }
120
121 // Load the library
122 return doLoad(dllName, handle);
123 }
124
126 unsigned long System::loadDynamicLib(const std::string& name, ImageHandle* handle) {
127 unsigned long res;
128 // if name is empty, just load it
129 if (name.length() == 0) {
130 res = loadWithoutEnvironment(name, handle);
131 } else {
132 // If the name is a logical name (environment variable), the try
133 // to load the corresponding library from there.
134 std::string imgName;
135 if ( getEnv(name, imgName) ) {
136 res = loadWithoutEnvironment(imgName, handle);
137 } else {
138 // build the dll name
139 std::string dllName = name;
140 // if the lib name contains '/' we can assume is the path to a file
141 // (relative or absolute), otherwise it might be a logical library name
142 // (i.e. without 'lib' and '.so')
143 if (dllName.find('/') == std::string::npos) {
144 #if defined(__linux) || defined(__APPLE__)
145 if (dllName.compare(0, 3, "lib") != 0)
146 dllName = "lib" + dllName;
147 #endif
148 if (dllName.find(SHLIB_SUFFIX) == std::string::npos)
149 dllName += SHLIB_SUFFIX;
150 }
151 // try to locate the dll using the standard PATH
152 res = loadWithoutEnvironment(dllName, handle);
153 }
154 if ( res != 1 ) {
155 #if defined(__linux) || defined(__APPLE__)
156 errno = 0xAFFEDEAD;
157 #endif
158 // std::cout << "System::loadDynamicLib>" << getLastErrorString() << std::endl;
159 }
160 }
161 return res;
162 }
163
165 unsigned long System::unloadDynamicLib(ImageHandle handle) {
166 #ifdef _WIN32
167 if ( !::FreeLibrary((HINSTANCE)handle) ) {
168 #elif defined(__linux) || defined(__APPLE__)
169 ::dlclose( handle );
170 if ( 0 ) {
171 #elif __hpux
172 // On HP we have to run finalization ourselves.....
173 Creator pFinalize = 0;
174 if ( getProcedureByName(handle, "_fini", &pFinalize) ) {
175 pFinalize();
176 }
177 HMODULE* mod = (HMODULE*)handle;
178 if ( 0 == ::shl_unload( mod->dsc.handle ) ) {
179 delete mod;
180 }
181 else {
182 #else
183 if (false){
184 #endif
185 return getLastError();
186 }
187 return 1;
188 }
189
191 unsigned long System::getProcedureByName(ImageHandle handle, const std::string& name, EntryPoint* pFunction) {
192 #ifdef _WIN32
193 *pFunction = (EntryPoint)::GetProcAddress((HINSTANCE)handle, name.data());
194 if ( 0 == *pFunction ) {
195 return System::getLastError();
196 }
197 return 1;
198 #elif defined(__linux)
199 #if __GNUC__ < 4
200 *pFunction = (EntryPoint)::dlsym(handle, name.c_str());
201 #else
202 *pFunction = FuncPtrCast<EntryPoint>(::dlsym(handle, name.c_str()));
203 #endif
204 if ( ! *pFunction ) {
205 errno = 0xAFFEDEAD;
206 // std::cout << "System::getProcedureByName>" << getLastErrorString() << std::endl;
207 return 0;
208 }
209 return 1;
210 #elif defined(__APPLE__)
211 *pFunction = (EntryPoint)::dlsym(handle, name.c_str());
212 if(!(*pFunction)) {
213 // Try with an underscore :
214 std::string sname = "_" + name;
215 *pFunction = (EntryPoint)::dlsym(handle, sname.c_str());
216 }
217 if ( 0 == *pFunction ) {
218 errno = 0xAFFEDEAD;
219 std::cout << "System::getProcedureByName>" << getLastErrorString() << std::endl;
220 //std::cout << "System::getProcedureByName> failure" << std::endl;
221 return 0;
222 }
223 return 1;
224 #elif __hpux
225 HMODULE* mod = (HMODULE*)handle;
226 if ( 0 != mod ) {
227 long ll1 = name.length();
228 for ( int i = 0; i < mod->numSym; i++ ) {
229 long ll2 = strlen(mod->sym[i].name);
230 if ( 0 != ::strncmp(mod->sym[i].name, name.c_str(), (ll1>ll2) ? ll1 : ll2)==0 ) {
231 *pFunction = (EntryPoint) mod->sym[i].value;
232 return 1;
233 }
234 }
235 }
236 return 0;
237 #endif
238 }
239
241 unsigned long System::getProcedureByName(ImageHandle handle, const std::string& name, Creator* pFunction) {
242 return getProcedureByName(handle, name, (EntryPoint*)pFunction);
243 }
244
246 unsigned long System::getLastError() {
247 #ifdef _WIN32
248 return ::GetLastError();
249 #else
250 // convert errno (int) to unsigned long
251 return static_cast<unsigned long>(static_cast<unsigned int>(errno));
252 #endif
253 }
254
256 const std::string System::getLastErrorString() {
257 const std::string errString = getErrorString(getLastError());
258 return errString;
259 }
260
262 const std::string System::getErrorString(unsigned long error) {
263 std::string errString = "";
264 #ifdef _WIN32
265 LPVOID lpMessageBuffer;
266 ::FormatMessage(
267 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
268 NULL,
269 error,
270 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
271 (LPTSTR) &lpMessageBuffer,
272 0,
273 NULL );
274 errString = (const char*)lpMessageBuffer;
275 // Free the buffer allocated by the system
276 ::LocalFree( lpMessageBuffer );
277 #else
278 char *cerrString(nullptr);
279 // Remember: for linux dl* routines must be handled differently!
280 if ( error == 0xAFFEDEAD ) {
281 cerrString = (char*)::dlerror();
282 if ( !cerrString ) cerrString = ::strerror(error);
283 if ( !cerrString ) {
284 cerrString = (char *)"Unknown error. No information found in strerror()!";
285 }
286 else {
287 errString = std::string(cerrString);
288 }
289 errno = 0;
290 }
291 else {
292 cerrString = ::strerror(error);
293 errString = std::string(cerrString);
294 }
295 #endif
296 return errString;
297 }
298
299 const std::string System::typeinfoName( const std::type_info& tinfo ) {
300 return typeinfoName( tinfo.name() );
301 }
302
303 const std::string System::typeinfoName( const char* class_name ) {
304 std::string result;
305 #ifdef _WIN32
306 long off = 0;
307 if ( ::strncmp(class_name, "class ", 6) == 0 ) {
308 // The returned name is prefixed with "class "
309 off = 6;
310 }
311 if ( ::strncmp(class_name, "struct ", 7) == 0 ) {
312 // The returned name is prefixed with "struct "
313 off = 7;
314 }
315 if ( off > 0 ) {
316 std::string tmp = class_name + off;
317 long loc = 0;
318 while( (loc = tmp.find("class ")) > 0 ) {
319 tmp.erase(loc, 6);
320 }
321 loc = 0;
322 while( (loc = tmp.find("struct ")) > 0 ) {
323 tmp.erase(loc, 7);
324 }
325 result = tmp;
326 }
327 else {
328 result = class_name;
329 }
330 // Change any " *" to "*"
331 while ( (off=result.find(" *")) != std::string::npos ) {
332 result.replace(off, 2, "*");
333 }
334 // Change any " &" to "&"
335 while ( (off=result.find(" &")) != std::string::npos ) {
336 result.replace(off, 2, "&");
337 }
338
339 #elif defined(__linux) || defined(__APPLE__)
340 int status;
341 auto realname = std::unique_ptr<char,decltype(free)*>( abi::__cxa_demangle(class_name, nullptr, nullptr, &status), std::free );
342 if (!realname) return class_name;
343 #if _GLIBCXX_USE_CXX11_ABI
344 static const std::regex cxx11_string{"std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > ?"};
345 result = std::regex_replace( realname.get(), cxx11_string, "std::string" );
346 #else
347 result = std::string{realname.get()};
348 #endif
349 // substitute ', ' with ','
350 static const std::regex comma_space{", "};
351 result = std::regex_replace( result, comma_space, "," );
352 #endif
353 return result;
354 }
355
356 namespace {
357 std::string init_hostName() {
358 std::array<char,512> buffer;
359 std::fill_n(buffer.begin(),buffer.size(),0);
360 #ifdef _WIN32
361 unsigned long len = buffer.size();
362 ::GetComputerName(buffer.data(), &len);
363 #else
364 ::gethostname(buffer.data(), buffer.size());
365 #endif
366 return { buffer.data() };
367 }
368 }
369
371 const std::string& System::hostName() {
372 static const std::string host = init_hostName();
373 return host;
374 }
375
377 const std::string& System::osName() {
378 static std::string osname = "";
379 #ifdef _WIN32
380 osname = "Windows";
381 #else
382 struct utsname ut;
383 if (uname(&ut) == 0) {
384 osname = ut.sysname;
385 } else {
386 osname = "UNKNOWN";
387 }
388 #endif
389 return osname;
390 }
391
392
394 const std::string& System::osVersion() {
395 static std::string osver = "";
396 #ifdef _WIN32
397 OSVERSIONINFO ut;
398 ut.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
399 ::GetVersionEx(&ut);
400 std::ostringstream ver;
401 ver << ut.dwMajorVersion << '.' << ut.dwMinorVersion;
402 osver = ver.str();
403 #else
404 struct utsname ut;
405 if (uname(&ut) == 0) {
406 osver = ut.release;
407 } else {
408 osver = "UNKNOWN";
409 }
410 #endif
411 return osver;
412 }
413
415 const std::string& System::machineType() {
416 static std::string mach = "";
417 #ifdef _WIN32
418 SYSTEM_INFO ut;
419 ::GetSystemInfo(&ut);
420 std::ostringstream arch;
421 arch << ut.wProcessorArchitecture;
422 mach = arch.str();
423 #else
424 struct utsname ut;
425 if (uname(&ut) == 0) {
426 mach = ut.machine;
427 } else {
428 mach = "UNKNOWN";
429 }
430 #endif
431 return mach;
432 }
433
434 int System::instructionsetLevel() {
435 return instrset_detect();
436 }
437
438
439
440
441
442
444 const std::string& System::accountName() {
445 static std::string account = "";
446 if ( account == "" ) {
447 #ifdef _WIN32
448 char buffer[512];
449 unsigned long buflen = sizeof(buffer);
450 ::GetUserName(buffer, &buflen);
451 account = buffer;
452 #else
453 const char* acct = ::getlogin();
454 if ( !acct ) acct = ::getenv("LOGNAME");
455 if ( !acct ) acct = ::getenv("USER");
456 account = (acct) ? acct : "Unknown";
457 #endif
458 }
459 return account;
460 }
461
463 long System::numCmdLineArgs() {
464 return cmdLineArgs().size();
465 }
466
468 long System::argc() {
469 return cmdLineArgs().size();
470 }
471
473 const std::vector<std::string> System::cmdLineArgs() {
474 if ( s_argvChars.size() == 0 ) {
475 char exe[1024];
476 #ifdef _WIN32
477 // Disable warning C4996 triggered by C standard library calls
479 #pragma warning(push)
480 #pragma warning(disable:4996)
481 // For compatibility with UNIX we CANNOT use strtok!
482 // If we would use strtok, options like -g="My world" at
483 // the command line level would result on NT in TWO options
484 // instead in one as in UNIX.
485 char *next, *tmp1, *tmp2;
486 for(LPTSTR cmd = ::GetCommandLine(); *cmd; cmd=next) {
487 memset(exe,0,sizeof(exe));
488 while ( *cmd == ' ' ) cmd++;
489 next=::strchr(cmd,' ');
490 if ( !next ) next = cmd + strlen(cmd);
491 if ( (tmp1=::strchr(cmd,'\"')) > 0 && tmp1 < next ) {
492 tmp2 = ::strchr(++tmp1,'\"');
493 if ( tmp2 > 0 ) {
494 next = ++tmp2;
495 if ( cmd < tmp1 ) strncpy(exe, cmd, tmp1-cmd-1);
496 strncpy(&exe[strlen(exe)], tmp1, tmp2-tmp1-1);
497 }
498 else {
499 std::cout << "Mismatched \" in command line arguments" << std::endl;
500 s_argvChars.erase(s_argvChars.begin(), s_argvChars.end());
501 s_argvStrings.erase(s_argvStrings.begin(), s_argvStrings.end());
502 return s_argvStrings;
503 }
504 }
505 else {
506 strncpy(exe, cmd, next-cmd);
507 }
508 s_argvStrings.push_back(exe);
509 s_argvChars.push_back( s_argvStrings.back().c_str());
510 }
511 #pragma warning(pop)
512 #elif defined(__linux) || defined(__APPLE__)
513 sprintf(exe, "/proc/%d/cmdline", ::getpid());
514 FILE *cmdLine = ::fopen(exe,"r");
515 char cmd[1024];
516 if ( cmdLine ) {
517 long len = fread(cmd, sizeof(char), sizeof(cmd), cmdLine);
518 if ( len > 0 ) {
519 cmd[len] = 0;
520 for ( char* token = cmd; token-cmd < len; token += strlen(token)+1 ) {
521 s_argvStrings.push_back(token);
522 s_argvChars.push_back( s_argvStrings.back().c_str());
523 }
524 s_argvStrings[0] = exeName();
525 s_argvChars[0] = s_argvStrings[0].c_str();
526 }
527 ::fclose(cmdLine);
528 }
529 #endif
530 }
531 return s_argvStrings;
532 }
533
535 char** System::argv() {
537 if( s_argvChars.empty() ) { cmdLineArgs(); }
538 // We rely here on the fact that a vector's allocation table is contiguous
540 return (char**)&s_argvChars[0];
541 }
542
543 #ifdef WIN32
544 // disable warning
545 // C4996: 'getenv': This function or variable may be unsafe.
546 #pragma warning(disable:4996)
547 #endif
548
550 std::string System::getEnv(const char* var) {
551 char* env;
552 if ( (env = getenv(var)) != nullptr ) {
553 return env;
554 } else {
555 return "UNKNOWN";
556 }
557 }
558
560 bool System::getEnv(const char* var, std::string &value) {
561 char* env;
562 if ( (env = getenv(var)) != nullptr ) {
563 value = env;
564 return true;
565 } else {
566 return false;
567 }
568 }
569
570 bool System::isEnvSet(const char* var) {
571 return getenv(var) != nullptr;
572 }
573
575 #if defined(__APPLE__)
576 // Needed for _NSGetEnviron(void)
577 #include "crt_externs.h"
578 #endif
579 std::vector<std::string> System::getEnv() {
580 #if defined(_WIN32)
581 # define environ _environ
582 #elif defined(__APPLE__)
583 static char **environ = *_NSGetEnviron();
584 #endif
585 std::vector<std::string> vars;
586 for (int i=0; environ[i] != nullptr; ++i) {
587 vars.push_back(environ[i]);
588 }
589 return vars;
590 }
591
592 // -----------------------------------------------------------------------------
593 // backtrace utilities
594 // -----------------------------------------------------------------------------
595 #ifdef __linux
596 #include <execinfo.h>
597 #endif
598
599 int System::backTrace(void** addresses __attribute__ ((unused)),
600 const int depth __attribute__ ((unused)))
601 {
602
603 #ifdef __linux
604
605 int count = backtrace( addresses, depth );
606 return count > 0 ? count : 0;
607
608 #else // windows and osx parts not implemented
609 return 0;
610 #endif
611
612 }
613
614 bool System::backTrace(std::string& btrace, const int depth, const int offset)
615 {
616 try {
617 // Always hide the first two levels of the stack trace (that's us)
618 const int totalOffset = offset + 2;
619 const int totalDepth = depth + totalOffset;
620
621 std::string fnc, lib;
622
623 std::vector<void*> addresses( totalDepth, nullptr );
624 int count = System::backTrace(addresses.data(),totalDepth);
625 for (int i = totalOffset; i < count; ++i) {
626 void *addr = nullptr;
627
628 if (System::getStackLevel(addresses[i],addr,fnc,lib)) {
629 std::ostringstream ost;
630 ost << "#" << std::setw(3) << std::setiosflags( std::ios::left ) << i-totalOffset+1;
631 ost << std::hex << addr << std::dec << " " << fnc << " [" << lib << "]" << std::endl;
632 btrace += ost.str();
633 }
634 }
635 return true;
636 } catch ( const std::bad_alloc& e ) {
637 return false;
638 }
639 }
640
641 bool System::getStackLevel(void* addresses __attribute__ ((unused)),
642 void*& addr __attribute__ ((unused)),
643 std::string& fnc __attribute__ ((unused)),
644 std::string& lib __attribute__ ((unused)))
645 {
646
647 #ifdef __linux
648
649 Dl_info info;
650
651 if ( dladdr( addresses, &info ) && info.dli_fname
652 && info.dli_fname[0] != '\0' ) {
653 const char* symbol = info.dli_sname
654 && info.dli_sname[0] != '\0' ? info.dli_sname : nullptr;
655
656 lib = info.dli_fname;
657 addr = info.dli_saddr;
658
659 if (symbol) {
660 int stat = -1;
661 auto dmg = std::unique_ptr<char,decltype(free)*>( abi::__cxa_demangle(symbol,nullptr,nullptr,&stat), std::free );
662 fnc = (stat == 0) ? dmg.get() : symbol;
663 } else {
664 fnc = "local";
665 }
666 return true ;
667 } else {
668 return false ;
669 }
670
671 #else // not implemented for windows and osx
672 return false ;
673 #endif
674
675 }
676
678 int System::setEnv(const std::string &name, const std::string &value, int overwrite)
679 {
680 #ifndef WIN32
681 // UNIX version
682 return value.empty() ?
683 // remove if set to nothing (and return success)
684 ::unsetenv(name.c_str()) , 0 :
685 // set the value
686 ::setenv(name.c_str(),value.c_str(), overwrite);
687 #else
688 // Windows version
689 if ( value.empty() ) {
690 // equivalent to unsetenv
691 return ::_putenv((name+"=").c_str());
692 }
693 else {
694 if ( !getenv(name.c_str()) || overwrite ) {
695 // set if not yet present or overwrite is set (force)
696 return ::_putenv((name+"="+value).c_str());
697 }
698 }
699 return 0; // if we get here, we are trying to set a variable already set, but
700 // not to overwrite.
701 // It is considered a success on Linux (man P setenv)
702 #endif
703
704 }
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:550
System.h
System::argc
GAUDI_API long argc()
Number of arguments passed to the commandline (==numCmdLineArgs()); just to match argv call...
Definition: System.cpp:468
System::argv
GAUDI_API char ** argv()
char** command line arguments including executable name as arg[0]; You may not modify them! ...
Definition: System.cpp:535
__attribute__
#define __attribute__(x)
Definition: System.cpp:72
std::vector::empty
T empty(T...args)
System::getErrorString
GAUDI_API const std::string getErrorString(unsigned long error)
Retrieve error code as string for a given error.
Definition: System.cpp:262
System::setEnv
GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite=1)
Set an environment variables.
Definition: System.cpp:678
System::getLastError
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:246
System::getProcedureByName
GAUDI_API unsigned long getProcedureByName(ImageHandle handle, const std::string &name, EntryPoint *pFunction)
Get a specific function defined in the DLL.
Definition: System.cpp:191
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:772
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
System::getStackLevel
GAUDI_API bool getStackLevel(void *addresses, void *&addr, std::string &fnc, std::string &lib)
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
instrset.h
System::instructionsetLevel
GAUDI_API int instructionsetLevel()
Instruction Set "Level".
Definition: System.cpp:434
Gaudi.CommonGaudiConfigurables.mod
mod
Definition: CommonGaudiConfigurables.py:22
System::accountName
GAUDI_API const std::string & accountName()
User login name.
Definition: System.cpp:444
std::endl
T endl(T...args)
std::vector::end
T end(T...args)
std::free
T free(T...args)
std::setiosflags
T setiosflags(T...args)
System::ImageHandle
void * ImageHandle
Definition of an image handle.
Definition: ModuleInfo.h:30
System::backTrace
GAUDI_API int backTrace(void **addresses, const int depth)
System::EntryPoint
unsigned long(* EntryPoint)(const unsigned long iid, void **ppvObject)
Definition of the "generic" DLL entry point function.
Definition: System.h:35
std::setw
T setw(T...args)
std::type_info
std::string
STL class.
System::numCmdLineArgs
GAUDI_API long numCmdLineArgs()
Number of arguments passed to the commandline.
Definition: System.cpp:463
System::exeName
GAUDI_API const std::string & exeName()
Name of the executable file running.
Definition: ModuleInfo.cpp:207
std::vector::push_back
T push_back(T...args)
std::string::data
T data(T...args)
std::string::replace
T replace(T...args)
std::regex_replace
T regex_replace(T...args)
std::ostringstream
STL class.
System::osName
GAUDI_API const std::string & osName()
OS name.
Definition: System.cpp:377
instrset_detect
int instrset_detect(void)
Definition: instrset_detect.cpp:91
std::string::erase
T erase(T...args)
std::ostringstream::str
T str(T...args)
compareOutputFiles.sname
sname
Definition: compareOutputFiles.py:393
System::unloadDynamicLib
GAUDI_API unsigned long unloadDynamicLib(ImageHandle handle)
unload dynamic link library
Definition: System.cpp:165
System::isEnvSet
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
Definition: System.cpp:570
std::unique_ptr::get
T get(T...args)
std::string::find
T find(T...args)
std::string::length
T length(T...args)
System::hostName
GAUDI_API const std::string & hostName()
Host name.
Definition: System.cpp:371
std::vector< std::string >
std::type_info::name
T name(T...args)
std::unique_ptr
STL class.
std::regex
std::array::begin
T begin(T...args)
std::bad_alloc
STL class.
std::string::c_str
T c_str(T...args)
std::vector::back
T back(T...args)
std::array< char, 512 >
std::fill_n
T fill_n(T...args)
std::hex
T hex(T...args)
System::cmdLineArgs
GAUDI_API const std::vector< std::string > cmdLineArgs()
Command line arguments including executable name as arg[0] as vector of strings.
Definition: System.cpp:473
System::osVersion
GAUDI_API const std::string & osVersion()
OS version.
Definition: System.cpp:394
System::getLastErrorString
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
Definition: System.cpp:256
System::machineType
GAUDI_API const std::string & machineType()
Machine type.
Definition: System.cpp:415
System::Creator
void *(* Creator)()
Definition of the "generic" DLL entry point function.
Definition: System.h:37
std::cout
std::string::compare
T compare(T...args)
System::loadDynamicLib
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.
Definition: System.cpp:126