System.cpp
Go to the documentation of this file.
1 // $Id: System.cpp,v 1.45 2008/10/27 21:30:32 marcocle Exp $
2 //====================================================================
3 // System.cpp
4 //--------------------------------------------------------------------
5 //
6 // Package : System (The LHCb System service)
7 //
8 // Description: Implementation of Systems internals
9 //
10 // Author : M.Frank
11 // Created : 13/1/99
12 // Changes :
13 //====================================================================
14 #define SYSTEM_SYSTEM_CPP
15 #include <ctime>
16 #include <cstring>
17 #include <cstdlib>
18 #include <iomanip>
19 #include <iostream>
20 #include <sstream>
21 #include <typeinfo>
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 ? 0 : 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 ( 0 == *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.substr(0, 3) != "lib")
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 ( 0 == *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(0);
277  // Remember: for linux dl* routines must be handled differently!
278  if ( error == 0xAFFEDEAD ) {
279  cerrString = (char*)::dlerror();
280  if ( 0 == cerrString ) {
281  cerrString = ::strerror(error);
282  }
283  if ( 0 == 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  if ( ::strlen(class_name) == 1 ) {
341  // See http://www.realitydiluted.com/mirrors/reality.sgi.com/dehnert_engr/cxx/abi.pdf
342  // for details
343  switch(class_name[0]) {
344  case 'v':
345  result = "void";
346  break;
347  case 'w':
348  result = "wchar_t";
349  break;
350  case 'b':
351  result = "bool";
352  break;
353  case 'c':
354  result = "char";
355  break;
356  case 'a':
357  result = "signed char";
358  break;
359  case 'h':
360  result = "unsigned char";
361  break;
362  case 's':
363  result = "short";
364  break;
365  case 't':
366  result = "unsigned short";
367  break;
368  case 'i':
369  result = "int";
370  break;
371  case 'j':
372  result = "unsigned int";
373  break;
374  case 'l':
375  result = "long";
376  break;
377  case 'm':
378  result = "unsigned long";
379  break;
380  case 'x':
381  result = "long long";
382  break;
383  case 'y':
384  result = "unsigned long long";
385  break;
386  case 'n':
387  result = "__int128";
388  break;
389  case 'o':
390  result = "unsigned __int128";
391  break;
392  case 'f':
393  result = "float";
394  break;
395  case 'd':
396  result = "double";
397  break;
398  case 'e':
399  result = "long double";
400  break;
401  case 'g':
402  result = "__float128";
403  break;
404  case 'z':
405  result = "ellipsis";
406  break;
407  }
408  }
409  else {
410  int status;
411  char* realname;
412  realname = abi::__cxa_demangle(class_name, 0, 0, &status);
413  if (realname == 0) return class_name;
414  result = realname;
415  free(realname);
417  std::string::size_type pos = result.find(", ");
418  while( std::string::npos != pos ) {
419  result.replace( pos , 2 , "," ) ;
420  pos = result.find(", ");
421  }
422  }
423 #endif
424  return result;
425 }
426 
428 const std::string& System::hostName() {
429  static std::string host = "";
430  if ( host == "" ) {
431  char buffer[512];
432  memset(buffer,0,sizeof(buffer));
433 #ifdef _WIN32
434  unsigned long len = sizeof(buffer);
435  ::GetComputerName(buffer, &len);
436 #else
437  ::gethostname(buffer, sizeof(buffer));
438 #endif
439  host = buffer;
440  }
441  return host;
442 }
443 
445 const std::string& System::osName() {
446  static std::string osname = "";
447 #ifdef _WIN32
448  osname = "Windows";
449 #else
450  struct utsname ut;
451  if (uname(&ut) == 0) {
452  osname = ut.sysname;
453  } else {
454  osname = "UNKNOWN";
455  }
456 #endif
457  return osname;
458 }
459 
460 
462 const std::string& System::osVersion() {
463  static std::string osver = "";
464 #ifdef _WIN32
465  OSVERSIONINFO ut;
466  ut.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
467  ::GetVersionEx(&ut);
468  std::ostringstream ver;
469  ver << ut.dwMajorVersion << '.' << ut.dwMinorVersion;
470  osver = ver.str();
471 #else
472  struct utsname ut;
473  if (uname(&ut) == 0) {
474  osver = ut.release;
475  } else {
476  osver = "UNKNOWN";
477  }
478 #endif
479  return osver;
480 }
481 
483 const std::string& System::machineType() {
484  static std::string mach = "";
485 #ifdef _WIN32
486  SYSTEM_INFO ut;
487  ::GetSystemInfo(&ut);
488  std::ostringstream arch;
489  arch << ut.wProcessorArchitecture;
490  mach = arch.str();
491 #else
492  struct utsname ut;
493  if (uname(&ut) == 0) {
494  mach = ut.machine;
495  } else {
496  mach = "UNKNOWN";
497  }
498 #endif
499  return mach;
500 }
501 
503  return instrset_detect();
504 }
505 
506 
507 
508 
509 
510 
512 const std::string& System::accountName() {
513  static std::string account = "";
514  if ( account == "" ) {
515 #ifdef _WIN32
516  char buffer[512];
517  unsigned long buflen = sizeof(buffer);
518  ::GetUserName(buffer, &buflen);
519  account = buffer;
520 #else
521  const char* acct = ::getlogin();
522  if ( 0 == acct ) acct = ::getenv("LOGNAME");
523  if ( 0 == acct ) acct = ::getenv("USER");
524  account = (acct) ? acct : "Unknown";
525 #endif
526  }
527  return account;
528 }
529 
532  return cmdLineArgs().size();
533 }
534 
536 long System::argc() {
537  return cmdLineArgs().size();
538 }
539 
541 const std::vector<std::string> System::cmdLineArgs() {
542  if ( s_argvChars.size() == 0 ) {
543  char exe[1024];
544 #ifdef _WIN32
545  // Disable warning C4996 triggered by C standard library calls
547 #pragma warning(push)
548 #pragma warning(disable:4996)
549  // For compatibility with UNIX we CANNOT use strtok!
550  // If we would use strtok, options like -g="My world" at
551  // the command line level would result on NT in TWO options
552  // instead in one as in UNIX.
553  char *next, *tmp1, *tmp2;
554  for(LPTSTR cmd = ::GetCommandLine(); *cmd; cmd=next) {
555  memset(exe,0,sizeof(exe));
556  while ( *cmd == ' ' ) cmd++;
557  next=::strchr(cmd,' ');
558  if ( !next ) next = cmd + strlen(cmd);
559  if ( (tmp1=::strchr(cmd,'\"')) > 0 && tmp1 < next ) {
560  tmp2 = ::strchr(++tmp1,'\"');
561  if ( tmp2 > 0 ) {
562  next = ++tmp2;
563  if ( cmd < tmp1 ) strncpy(exe, cmd, tmp1-cmd-1);
564  strncpy(&exe[strlen(exe)], tmp1, tmp2-tmp1-1);
565  }
566  else {
567  std::cout << "Mismatched \" in command line arguments" << std::endl;
568  s_argvChars.erase(s_argvChars.begin(), s_argvChars.end());
569  s_argvStrings.erase(s_argvStrings.begin(), s_argvStrings.end());
570  return s_argvStrings;
571  }
572  }
573  else {
574  strncpy(exe, cmd, next-cmd);
575  }
576  s_argvStrings.push_back(exe);
577  s_argvChars.push_back( s_argvStrings.back().c_str());
578  }
579 #pragma warning(pop)
580 #elif defined(__linux) || defined(__APPLE__)
581  sprintf(exe, "/proc/%d/cmdline", ::getpid());
582  FILE *cmdLine = ::fopen(exe,"r");
583  char cmd[1024];
584  if ( cmdLine ) {
585  long len = fread(cmd, sizeof(char), sizeof(cmd), cmdLine);
586  if ( len > 0 ) {
587  cmd[len] = 0;
588  for ( char* token = cmd; token-cmd < len; token += strlen(token)+1 ) {
589  s_argvStrings.push_back(token);
590  s_argvChars.push_back( s_argvStrings.back().c_str());
591  }
592  s_argvStrings[0] = exeName();
593  s_argvChars[0] = s_argvStrings[0].c_str();
594  }
595  ::fclose(cmdLine);
596  }
597 #endif
598  }
599  return s_argvStrings;
600 }
601 
603 char** System::argv() {
605  if( s_argvChars.empty() ) { cmdLineArgs(); }
606  // We rely here on the fact that a vector's allocation table is contiguous
608  return (char**)&s_argvChars[0];
609 }
610 
611 #ifdef WIN32
612 // disable warning
613 // C4996: 'getenv': This function or variable may be unsafe.
614 #pragma warning(disable:4996)
615 #endif
616 
618 std::string System::getEnv(const char* var) {
619  char* env;
620  if ( (env = getenv(var)) != 0 ) {
621  return env;
622  } else {
623  return "UNKNOWN";
624  }
625 }
626 
628 bool System::getEnv(const char* var, std::string &value) {
629  char* env;
630  if ( (env = getenv(var)) != 0 ) {
631  value = env;
632  return true;
633  } else {
634  return false;
635  }
636 }
637 
638 bool System::isEnvSet(const char* var) {
639  return getenv(var) != 0;
640 }
641 
643 #if defined(__APPLE__)
644 // Needed for _NSGetEnviron(void)
645 #include "crt_externs.h"
646 #endif
647 std::vector<std::string> System::getEnv() {
648 #if defined(_WIN32)
649 # define environ _environ
650 #elif defined(__APPLE__)
651  static char **environ = *_NSGetEnviron();
652 #endif
653  std::vector<std::string> vars;
654  for (int i=0; environ[i] != 0; ++i) {
655  vars.push_back(environ[i]);
656  }
657  return vars;
658 }
659 
660 // -----------------------------------------------------------------------------
661 // backtrace utilities
662 // -----------------------------------------------------------------------------
663 #ifdef __linux
664 #include <execinfo.h>
665 #endif
666 
667 int System::backTrace(void** addresses __attribute__ ((unused)),
668  const int depth __attribute__ ((unused)))
669 {
670 
671 #ifdef __linux
672 
673  int count = backtrace( addresses, depth );
674  if ( count > 0 ) {
675  return count;
676  } else {
677  return 0;
678  }
679 
680 #else // windows and osx parts not implemented
681  return 0;
682 #endif
683 
684 }
685 
686 bool System::backTrace(std::string& btrace, const int depth, const int offset)
687 {
688  // Always hide the first two levels of the stack trace (that's us)
689  const int totalOffset = offset + 2;
690  const int totalDepth = depth + totalOffset;
691 
692  std::string fnc, lib;
693 
694  void** addresses = (void**) malloc(totalDepth*sizeof(void *));
695  if ( addresses != 0 ){
696  int count = System::backTrace(addresses,totalDepth);
697  for (int i = totalOffset; i < count; ++i) {
698  void *addr = 0;
699 
700  if (System::getStackLevel(addresses[i],addr,fnc,lib)) {
701  std::ostringstream ost;
702  ost << "#" << std::setw(3) << std::setiosflags( std::ios::left ) << i-totalOffset+1;
703  ost << std::hex << addr << std::dec << " " << fnc << " [" << lib << "]" << std::endl;
704  btrace += ost.str();
705  }
706  }
707  free(addresses);
708  }
709  else {
710  free(addresses);
711  return false;
712  }
713 
714  return true;
715 }
716 
717 bool System::getStackLevel(void* addresses __attribute__ ((unused)),
718  void*& addr __attribute__ ((unused)),
719  std::string& fnc __attribute__ ((unused)),
720  std::string& lib __attribute__ ((unused)))
721 {
722 
723 #ifdef __linux
724 
725  Dl_info info;
726 
727  if ( dladdr( addresses, &info ) && info.dli_fname
728  && info.dli_fname[0] != '\0' ) {
729  const char* symbol = info.dli_sname
730  && info.dli_sname[0] != '\0' ? info.dli_sname : 0;
731 
732  lib = info.dli_fname;
733  addr = info.dli_saddr;
734  const char* dmg(0);
735 
736  if (symbol != 0) {
737  int stat;
738  dmg = abi::__cxa_demangle(symbol,0,0,&stat);
739  fnc = (stat == 0) ? dmg : symbol;
740  } else {
741  fnc = "local";
742  }
743  free((void*)dmg);
744  return true ;
745  } else {
746  return false ;
747  }
748 
749 #else // not implemented for windows and osx
750  return false ;
751 #endif
752 
753 }
754 
756 int System::setEnv(const std::string &name, const std::string &value, int overwrite)
757 {
758 #ifndef WIN32
759  // UNIX version
760  return value.empty() ?
761  // remove if set to nothing (and return success)
762  ::unsetenv(name.c_str()) , 0 :
763  // set the value
764  ::setenv(name.c_str(),value.c_str(), overwrite);
765 #else
766  // Windows version
767  if ( value.empty() ) {
768  // equivalent to unsetenv
769  return ::_putenv((name+"=").c_str());
770  }
771  else {
772  if ( !getenv(name.c_str()) || overwrite ) {
773  // set if not yet present or overwrite is set (force)
774  return ::_putenv((name+"="+value).c_str());
775  }
776  }
777  return 0; // if we get here, we are trying to set a variable already set, but
778  // not to overwrite.
779  // It is considered a success on Linux (man P setenv)
780 #endif
781 
782 }
GAUDI_API const std::string & osName()
OS name.
Definition: System.cpp:445
#define __attribute__(x)
Definition: System.cpp:70
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
GAUDI_API bool getStackLevel(void *addresses, void *&addr, std::string &fnc, std::string &lib)
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:244
list path
Definition: __init__.py:15
return false
Definition: Bootstrap.cpp:338
void * ImageHandle
Definition of an image handle.
Definition: ModuleInfo.h:30
GAUDI_API const std::string & exeName()
Name of the executable file running.
Definition: ModuleInfo.cpp:208
GAUDI_API long argc()
Number of arguments passed to the commandline (==numCmdLineArgs()); just to match argv call...
Definition: System.cpp:536
GAUDI_API int backTrace(void **addresses, const int depth)
GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite=1)
Set an environment variables.
Definition: System.cpp:756
GAUDI_API const std::string getErrorString(unsigned long error)
Retrieve error code as string for a given error.
Definition: System.cpp:260
int instrset_detect(void)
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
Definition: System.cpp:638
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:618
GAUDI_API int instructionsetLevel()
Instruction Set "Level".
Definition: System.cpp:502
GAUDI_API const std::string & machineType()
Machine type.
Definition: System.cpp:483
void *(* Creator)()
Definition of the "generic" DLL entry point function.
Definition: System.h:38
GAUDI_API long numCmdLineArgs()
Number of arguments passed to the commandline.
Definition: System.cpp:531
GAUDI_API const std::string & hostName()
Host name.
Definition: System.cpp:428
GAUDI_API char ** argv()
char** command line arguments including executable name as arg[0]; You may not modify them! ...
Definition: System.cpp:603
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
Definition: System.cpp:254
GAUDI_API const std::string & accountName()
User login name.
Definition: System.cpp:512
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.
Definition: System.cpp:124
GAUDI_API unsigned long unloadDynamicLib(ImageHandle handle)
unload dynamic link library
Definition: System.cpp:163
unsigned long(* EntryPoint)(const unsigned long iid, void **ppvObject)
Definition of the "generic" DLL entry point function.
Definition: System.h:36
list i
Definition: ana.py:128
GAUDI_API const std::vector< std::string > cmdLineArgs()
Command line arguments including executable name as arg[0] as vector of strings.
Definition: System.cpp:541
GAUDI_API const std::string & osVersion()
OS version.
Definition: System.cpp:462