| The Gaudi Framework v27r1

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