| The Gaudi Framework v29r1 (5cd95fa2)

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