Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:28

0001 // @(#)root/base:$Id$
0002 // Author: Fons Rademakers   15/09/95
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TSystem
0013 #define ROOT_TSystem
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TSystem                                                              //
0019 //                                                                      //
0020 // Abstract base class defining a generic interface to the underlying   //
0021 // Operating System.                                                    //
0022 //                                                                      //
0023 //////////////////////////////////////////////////////////////////////////
0024 
0025 #include <cstdio>
0026 #include <cctype>
0027 #include <fcntl.h>
0028 #ifndef _WIN32
0029 #include <unistd.h>
0030 #endif
0031 
0032 #include "TNamed.h"
0033 #include "TInetAddress.h"
0034 #include "TTimer.h"
0035 #include <string>
0036 
0037 class TSeqCollection;
0038 class TFdSet;
0039 class TVirtualMutex;
0040 
0041 enum EAccessMode {
0042    kFileExists        = 0,
0043    kExecutePermission = 1,
0044    kWritePermission   = 2,
0045    kReadPermission    = 4
0046 };
0047 
0048 enum ELogOption {
0049    kLogPid            = 0x01,
0050    kLogCons           = 0x02
0051 };
0052 
0053 enum ELogLevel {
0054    kLogEmerg          = 0,
0055    kLogAlert          = 1,
0056    kLogCrit           = 2,
0057    kLogErr            = 3,
0058    kLogWarning        = 4,
0059    kLogNotice         = 5,
0060    kLogInfo           = 6,
0061    kLogDebug          = 7
0062 };
0063 
0064 enum ELogFacility {
0065    kLogLocal0,
0066    kLogLocal1,
0067    kLogLocal2,
0068    kLogLocal3,
0069    kLogLocal4,
0070    kLogLocal5,
0071    kLogLocal6,
0072    kLogLocal7
0073 };
0074 
0075 enum EFpeMask {
0076    kNoneMask         = 0x00,
0077    kInvalid          = 0x01,  // Invalid argument
0078    kDivByZero        = 0x02,  // Division by zero
0079    kOverflow         = 0x04,  // Overflow
0080    kUnderflow        = 0x08,  // Underflow
0081    kInexact          = 0x10,  // Inexact
0082    kDefaultMask      = 0x07,
0083    kAllMask          = 0x1F
0084 };
0085 
0086 enum EFileModeMask {
0087    kS_IFMT   = 0170000,   // bitmask for the file type bitfields
0088    kS_IFSOCK = 0140000,   // socket
0089    kS_IFLNK  = 0120000,   // symbolic link
0090    kS_IFOFF  = 0110000,   // offline file
0091    kS_IFREG  = 0100000,   // regular file
0092    kS_IFBLK  = 0060000,   // block device
0093    kS_IFDIR  = 0040000,   // directory
0094    kS_IFCHR  = 0020000,   // character device
0095    kS_IFIFO  = 0010000,   // fifo
0096    kS_ISUID  = 0004000,   // set UID bit
0097    kS_ISGID  = 0002000,   // set GID bit
0098    kS_ISVTX  = 0001000,   // sticky bit
0099    kS_IRWXU  = 00700,     // mask for file owner permissions
0100    kS_IRUSR  = 00400,     // owner has read permission
0101    kS_IWUSR  = 00200,     // owner has write permission
0102    kS_IXUSR  = 00100,     // owner has execute permission
0103    kS_IRWXG  = 00070,     // mask for group permissions
0104    kS_IRGRP  = 00040,     // group has read permission
0105    kS_IWGRP  = 00020,     // group has write permission
0106    kS_IXGRP  = 00010,     // group has execute permission
0107    kS_IRWXO  = 00007,     // mask for permissions for others (not in group)
0108    kS_IROTH  = 00004,     // others have read permission
0109    kS_IWOTH  = 00002,     // others have write permission
0110    kS_IXOTH  = 00001      // others have execute permission
0111 };
0112 
0113 inline Bool_t R_ISDIR(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFDIR); }
0114 inline Bool_t R_ISCHR(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFCHR); }
0115 inline Bool_t R_ISBLK(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFBLK); }
0116 inline Bool_t R_ISREG(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFREG); }
0117 inline Bool_t R_ISLNK(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFLNK); }
0118 inline Bool_t R_ISFIFO(Int_t mode) { return ((mode & kS_IFMT) == kS_IFIFO); }
0119 inline Bool_t R_ISSOCK(Int_t mode) { return ((mode & kS_IFMT) == kS_IFSOCK); }
0120 inline Bool_t R_ISOFF(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFOFF); }
0121 
0122 struct FileStat_t {
0123    Long_t   fDev;          // device id
0124    Long_t   fIno;          // inode
0125    Int_t    fMode;         // protection (combination of EFileModeMask bits)
0126    Int_t    fUid;          // user id of owner
0127    Int_t    fGid;          // group id of owner
0128    Long64_t fSize;         // total size in bytes
0129    Long_t   fMtime;        // modification date
0130    Bool_t   fIsLink;       // symbolic link
0131    TString  fUrl;          // end point url of file
0132    FileStat_t() : fDev(0), fIno(0), fMode(0), fUid(0), fGid(0), fSize(0),
0133                   fMtime(0), fIsLink(kFALSE), fUrl("") { }
0134 };
0135 
0136 struct UserGroup_t {
0137    Int_t    fUid;          // user id
0138    Int_t    fGid;          // group id
0139    TString  fUser;         // user name
0140    TString  fGroup;        // group name
0141    TString  fPasswd;       // password
0142    TString  fRealName;     // user full name
0143    TString  fShell;        // user preferred shell
0144    UserGroup_t() : fUid(0), fGid(0), fUser(), fGroup(), fPasswd(),
0145                    fRealName (), fShell() { }
0146 };
0147 
0148 struct SysInfo_t {
0149    TString   fOS;          // OS
0150    TString   fModel;       // computer model
0151    TString   fCpuType;     // type of cpu
0152    Int_t     fCpus;        // number of cpus
0153    Int_t     fCpuSpeed;    // cpu speed in MHz
0154    Int_t     fBusSpeed;    // bus speed in MHz
0155    Int_t     fL2Cache;     // level 2 cache size in KB
0156    Int_t     fPhysRam;     // physical RAM in MB
0157    SysInfo_t() : fOS(), fModel(), fCpuType(), fCpus(0), fCpuSpeed(0),
0158                  fBusSpeed(0), fL2Cache(0), fPhysRam(0) { }
0159    virtual ~SysInfo_t() { }
0160    ClassDef(SysInfo_t, 1); // System information - OS, CPU, RAM.
0161 };
0162 
0163 struct CpuInfo_t {
0164    Float_t   fLoad1m;      // cpu load average over 1 m
0165    Float_t   fLoad5m;      // cpu load average over 5 m
0166    Float_t   fLoad15m;     // cpu load average over 15 m
0167    Float_t   fUser;        // cpu user load in percentage
0168    Float_t   fSys;         // cpu sys load in percentage
0169    Float_t   fTotal;       // cpu user+sys load in percentage
0170    Float_t   fIdle;        // cpu idle percentage
0171    CpuInfo_t() : fLoad1m(0), fLoad5m(0), fLoad15m(0),
0172                  fUser(0), fSys(0), fTotal(0), fIdle(0) { }
0173    virtual ~CpuInfo_t() { }
0174    ClassDef(CpuInfo_t, 1); // CPU load information.
0175 };
0176 
0177 struct MemInfo_t {
0178    Int_t     fMemTotal;    // total RAM in MB
0179    Int_t     fMemUsed;     // used RAM in MB
0180    Int_t     fMemFree;     // free RAM in MB
0181    Int_t     fSwapTotal;   // total swap in MB
0182    Int_t     fSwapUsed;    // used swap in MB
0183    Int_t     fSwapFree;    // free swap in MB
0184    MemInfo_t() : fMemTotal(0), fMemUsed(0), fMemFree(0),
0185                  fSwapTotal(0), fSwapUsed(0), fSwapFree(0) { }
0186    virtual ~MemInfo_t() { }
0187    ClassDef(MemInfo_t, 1); // Memory utilization information.
0188 };
0189 
0190 struct ProcInfo_t {
0191    Float_t   fCpuUser;     // user time used by this process in seconds
0192    Float_t   fCpuSys;      // system time used by this process in seconds
0193    Long_t    fMemResident; // resident memory used by this process in KB
0194    Long_t    fMemVirtual;  // virtual memory used by this process in KB
0195    ProcInfo_t() : fCpuUser(0), fCpuSys(0), fMemResident(0),
0196                   fMemVirtual(0) { }
0197    virtual ~ProcInfo_t();
0198    ClassDef(ProcInfo_t, 1);// System resource usage of given process.
0199 };
0200 
0201 struct RedirectHandle_t {
0202    TString   fFile;            // File where the output was redirected
0203    TString   fStdOutTty;       // tty associated with stdout, if any (e.g. from ttyname(...))
0204    TString   fStdErrTty;       // tty associated with stderr, if any (e.g. from ttyname(...))
0205    Int_t     fStdOutDup{-1};   // Duplicated descriptor for stdout
0206    Int_t     fStdErrDup{-1};   // Duplicated descriptor for stderr
0207    Int_t     fReadOffSet{-1};  // Offset where to start reading the file (used by ShowOutput(...))
0208    RedirectHandle_t(const char *n = nullptr) : fFile(n) { }
0209    void Reset() { fFile = ""; fStdOutTty = ""; fStdErrTty = "";
0210                   fStdOutDup = -1; fStdErrDup = -1; fReadOffSet = -1; }
0211 };
0212 
0213 enum ESockOptions {
0214    kSendBuffer,        // size of send buffer
0215    kRecvBuffer,        // size of receive buffer
0216    kOobInline,         // OOB message inline
0217    kKeepAlive,         // keep socket alive
0218    kReuseAddr,         // allow reuse of local portion of address 5-tuple
0219    kNoDelay,           // send without delay
0220    kNoBlock,           // non-blocking I/O
0221    kProcessGroup,      // socket process group (used for SIGURG and SIGIO)
0222    kAtMark,            // are we at out-of-band mark (read only)
0223    kBytesToRead        // get number of bytes to read, FIONREAD (read only)
0224 };
0225 
0226 enum ESendRecvOptions {
0227    kDefault,           // default option (= 0)
0228    kOob,               // send or receive out-of-band data
0229    kPeek,              // peek at incoming message (receive only)
0230    kDontBlock          // send/recv as much data as possible without blocking
0231 };
0232 
0233 typedef void (*Func_t)();
0234 
0235 R__EXTERN const char  *gRootDir;
0236 R__EXTERN const char  *gProgName;
0237 R__EXTERN const char  *gProgPath;
0238 R__EXTERN TVirtualMutex *gSystemMutex;
0239 
0240 
0241 //////////////////////////////////////////////////////////////////////////
0242 //                                                                      //
0243 // Asynchronous timer used for processing pending GUI and timer events  //
0244 // every delay ms. Call in a tight computing loop                       //
0245 // TProcessEventTimer::ProcessEvent(). If the timer did timeout this    //
0246 // call will process the pending events and return kTRUE if the         //
0247 // TROOT::IsInterrupted() flag is set (can be done by hitting key in    //
0248 // canvas or selecting canvas menu item View/Interrupt.                 //
0249 //                                                                      //
0250 //////////////////////////////////////////////////////////////////////////
0251 class TProcessEventTimer : public TTimer {
0252 public:
0253    TProcessEventTimer(Long_t delay);
0254    Bool_t Notify() override { return kTRUE; }
0255    Bool_t ProcessEvents();
0256    ClassDefOverride(TProcessEventTimer,0)  // Process pending events at fixed time intervals
0257 };
0258 
0259 
0260 class TSystem : public TNamed {
0261 
0262 public:
0263    enum EAclicMode { kDefault, kDebug, kOpt };
0264    enum EAclicProperties {
0265       kFlatBuildDir = BIT(0)           // If set and a BuildDir is selected, then do not created sub-directories
0266    };
0267 
0268 protected:
0269    TFdSet          *fReadmask{nullptr};         //!Files that should be checked for read events
0270    TFdSet          *fWritemask{nullptr};        //!Files that should be checked for write events
0271    TFdSet          *fReadready{nullptr};        //!Files with reads waiting
0272    TFdSet          *fWriteready{nullptr};       //!Files with writes waiting
0273    TFdSet          *fSignals{nullptr};          //!Signals that were trapped
0274    Int_t            fNfd{0};                    //Number of fd's in masks
0275    Int_t            fMaxrfd{-1};                //Largest fd in read mask
0276    Int_t            fMaxwfd{-1};                //Largest fd in write mask
0277    Int_t            fSigcnt{0};                 //Number of pending signals
0278    TString          fWdpath;                    //Working directory
0279    TString          fHostname;                  //Hostname
0280    std::atomic<Bool_t> fInsideNotify{kFALSE};   //Used by DispatchTimers()
0281    Int_t            fBeepFreq{0};               //Used by Beep()
0282    Int_t            fBeepDuration{0};           //Used by Beep()
0283 
0284    Bool_t           fInControl{kFALSE};         //True if in eventloop
0285    Bool_t           fDone{kFALSE};              //True if eventloop should be finished
0286    Int_t            fLevel{0};                  //Level of nested eventloops
0287 
0288    TList           *fTimers{nullptr};           //List of timers
0289    TSeqCollection  *fSignalHandler{nullptr};    //List of signal handlers
0290    TSeqCollection  *fFileHandler{nullptr};      //List of file handlers
0291    TSeqCollection  *fStdExceptionHandler{nullptr}; //List of std::exception handlers
0292    TSeqCollection  *fOnExitList{nullptr};       //List of items to be cleaned-up on exit
0293 
0294    TString          fListLibs;                  //List shared libraries, cache used by GetLibraries
0295 
0296    TString          fBuildArch;                 //Architecture for which ROOT was built (passed to ./configure)
0297    TString          fBuildCompiler;             //Compiler used to build this ROOT
0298    TString          fBuildCompilerVersion;      //Compiler version used to build this ROOT
0299    TString          fBuildCompilerVersionStr;   //Compiler version identifier string used to build this ROOT
0300    TString          fBuildNode;                 //Detailed information where ROOT was built
0301    TString          fBuildDir;                  //Location where to build ACLiC shared library and use as scratch area.
0302    TString          fFlagsDebug;                //Flags for debug compilation
0303    TString          fFlagsOpt;                  //Flags for optimized compilation
0304    TString          fListPaths;                 //List of all include (fIncludePath + interpreter include path). Cache used by GetIncludePath
0305    TString          fIncludePath;               //Used to expand $IncludePath in the directives given to SetMakeSharedLib and SetMakeExe
0306    TString          fLinkedLibs;                //Used to expand $LinkedLibs in the directives given to SetMakeSharedLib and SetMakeExe
0307    TString          fSoExt;                     //Extension of shared library (.so, .sl, .a, .dll, etc.)
0308    TString          fObjExt;                    //Extension of object files (.o, .obj, etc.)
0309    EAclicMode       fAclicMode{kDefault};       //Whether the compilation should be done debug or opt
0310    TString          fMakeSharedLib;             //Directive used to build a shared library
0311    TString          fMakeExe;                   //Directive used to build an executable
0312    TString          fLinkdefSuffix;             //Default suffix for linkdef files to be used by ACLiC (see EACLiCProperties)
0313    Int_t            fAclicProperties{0};        //Various boolean flag for change ACLiC's behavior.
0314    TSeqCollection  *fCompiled{nullptr};         //List of shared libs from compiled macros to be deleted
0315    TSeqCollection  *fHelpers{nullptr};          //List of helper classes for alternative file/directory access
0316 
0317    TString &GetLastErrorString();             //Last system error message (thread local).
0318    const TString &GetLastErrorString() const; //Last system error message (thread local).
0319 
0320    TSystem               *FindHelper(const char *path, void *dirptr = nullptr);
0321    virtual Bool_t         ConsistentWith(const char *path, void *dirptr = nullptr);
0322    virtual const char    *ExpandFileName(const char *fname);
0323    virtual Bool_t         ExpandFileName(TString &fname);
0324    virtual void           SigAlarmInterruptsSyscalls(Bool_t) { }
0325    virtual const char    *GetLinkedLibraries();
0326    virtual void           DoBeep(Int_t /*freq*/=-1, Int_t /*duration*/=-1) const { printf("\a"); fflush(stdout); }
0327 
0328    static const char     *StripOffProto(const char *path, const char *proto);
0329 
0330 private:
0331    TSystem(const TSystem&) = delete;
0332    TSystem& operator=(const TSystem&) = delete;
0333    Bool_t ExpandFileName(const char *fname, char *xname, const int kBufSize);
0334 
0335 public:
0336    TSystem(const char *name = "Generic", const char *title = "Generic System");
0337    virtual ~TSystem();
0338 
0339    //---- Misc
0340    virtual Bool_t          Init();
0341    virtual void            SetProgname(const char *name);
0342    virtual void            SetDisplay();
0343    void                    SetErrorStr(const char *errstr);
0344    const char             *GetErrorStr() const { return GetLastErrorString(); }
0345    virtual const char     *GetError();
0346    virtual Int_t           GetCryptoRandom(void *buf, Int_t len);
0347    void                    RemoveOnExit(TObject *obj);
0348    virtual const char     *HostName();
0349    virtual void            NotifyApplicationCreated();
0350 
0351    static Int_t            GetErrno();
0352    static void             ResetErrno();
0353    void                    Beep(Int_t freq=-1, Int_t duration=-1, Bool_t setDefault=kFALSE);
0354    void                    GetBeepDefaults(Int_t &freq, Int_t &duration) const { freq = fBeepFreq; duration = fBeepDuration; }
0355 
0356    //---- EventLoop
0357    virtual void            Run();
0358    virtual Bool_t          ProcessEvents();
0359    virtual void            DispatchOneEvent(Bool_t pendingOnly = kFALSE);
0360    virtual void            ExitLoop();
0361    Bool_t                  InControl() const { return fInControl; }
0362    virtual void            InnerLoop();
0363    virtual Int_t           Select(TList *active, Long_t timeout);
0364    virtual Int_t           Select(TFileHandler *fh, Long_t timeout);
0365 
0366    //---- Handling of system events
0367    virtual void            AddSignalHandler(TSignalHandler *sh);
0368    virtual TSignalHandler *RemoveSignalHandler(TSignalHandler *sh);
0369    virtual void            ResetSignal(ESignals sig, Bool_t reset = kTRUE);
0370    virtual void            ResetSignals();
0371    virtual void            IgnoreSignal(ESignals sig, Bool_t ignore = kTRUE);
0372    virtual void            IgnoreInterrupt(Bool_t ignore = kTRUE);
0373    virtual TSeqCollection *GetListOfSignalHandlers() const { return fSignalHandler; }
0374    virtual void            AddFileHandler(TFileHandler *fh);
0375    virtual TFileHandler   *RemoveFileHandler(TFileHandler *fh);
0376    virtual TSeqCollection *GetListOfFileHandlers() const { return fFileHandler; }
0377    virtual void            AddStdExceptionHandler(TStdExceptionHandler *eh);
0378    virtual TStdExceptionHandler *RemoveStdExceptionHandler(TStdExceptionHandler *eh);
0379    virtual TSeqCollection *GetListOfStdExceptionHandlers() const { return fStdExceptionHandler; }
0380 
0381    //---- Floating Point Exceptions Control
0382    virtual Int_t           GetFPEMask();
0383    virtual Int_t           SetFPEMask(Int_t mask = kDefaultMask);
0384 
0385    //---- Time & Date
0386    virtual TTime           Now();
0387    virtual TList          *GetListOfTimers() const { return fTimers; }
0388    virtual void            AddTimer(TTimer *t);
0389    virtual TTimer         *RemoveTimer(TTimer *t);
0390    virtual void            ResetTimer(TTimer *) { }
0391    virtual Long_t          NextTimeOut(Bool_t mode);
0392    virtual void            Sleep(UInt_t milliSec);
0393 
0394    //---- Processes
0395    virtual Int_t           Exec(const char *shellcmd);
0396    virtual FILE           *OpenPipe(const char *command, const char *mode);
0397    virtual int             ClosePipe(FILE *pipe);
0398    virtual TString         GetFromPipe(const char *command);
0399    virtual int             GetPid();
0400    virtual void            StackTrace();
0401 
0402    [[ noreturn ]] virtual void Exit(int code, Bool_t mode = kTRUE);
0403    [[ noreturn ]] virtual void Abort(int code = 0);
0404 
0405    //---- Directories
0406    virtual int             MakeDirectory(const char *name);
0407    virtual void           *OpenDirectory(const char *name);
0408    virtual void            FreeDirectory(void *dirp);
0409    virtual const char     *GetDirEntry(void *dirp);
0410    virtual void           *GetDirPtr() const { return nullptr; }
0411    virtual Bool_t          ChangeDirectory(const char *path);
0412    virtual const char     *WorkingDirectory();
0413    virtual std::string     GetWorkingDirectory() const;
0414    virtual const char     *HomeDirectory(const char *userName = nullptr);
0415    virtual std::string     GetHomeDirectory(const char *userName = nullptr) const;
0416    virtual int             mkdir(const char *name, Bool_t recursive = kFALSE);
0417    Bool_t                  cd(const char *path) { return ChangeDirectory(path); }
0418    const char             *pwd() { return WorkingDirectory(); }
0419    virtual const char     *TempDirectory() const;
0420    virtual FILE           *TempFileName(TString &base, const char *dir = nullptr, const char *suffix = nullptr);
0421 
0422    //---- Paths & Files
0423    virtual const char     *BaseName(const char *pathname);
0424    virtual const char     *DirName(const char *pathname);
0425    virtual TString         GetDirName(const char *pathname);
0426    virtual char           *ConcatFileName(const char *dir, const char *name);
0427    virtual Bool_t          IsAbsoluteFileName(const char *dir);
0428    virtual Bool_t          IsFileInIncludePath(const char *name, char **fullpath = nullptr);
0429    virtual const char     *PrependPathName(const char *dir, TString& name);
0430    virtual Bool_t          ExpandPathName(TString &path);
0431    virtual char           *ExpandPathName(const char *path);
0432    virtual Bool_t          AccessPathName(const char *path, EAccessMode mode = kFileExists);
0433    virtual Bool_t          IsPathLocal(const char *path);
0434    virtual int             CopyFile(const char *from, const char *to, Bool_t overwrite = kFALSE);
0435    virtual int             Rename(const char *from, const char *to);
0436    virtual int             Link(const char *from, const char *to);
0437    virtual int             Symlink(const char *from, const char *to);
0438    virtual int             Unlink(const char *name);
0439    int                     GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime);
0440    int                     GetPathInfo(const char *path, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime);
0441    virtual int             GetPathInfo(const char *path, FileStat_t &buf);
0442    virtual int             GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree);
0443    virtual int             Chmod(const char *file, UInt_t mode);
0444    virtual int             Umask(Int_t mask);
0445    virtual int             Utime(const char *file, Long_t modtime, Long_t actime);
0446    virtual const char     *UnixPathName(const char *unixpathname);
0447    virtual const char     *FindFile(const char *search, TString& file, EAccessMode mode = kFileExists);
0448    virtual char           *Which(const char *search, const char *file, EAccessMode mode = kFileExists);
0449    virtual TList          *GetVolumes(Option_t *) const { return nullptr; }
0450 
0451    //---- Users & Groups
0452    virtual Int_t           GetUid(const char *user = nullptr);
0453    virtual Int_t           GetGid(const char *group = nullptr);
0454    virtual Int_t           GetEffectiveUid();
0455    virtual Int_t           GetEffectiveGid();
0456    virtual UserGroup_t    *GetUserInfo(Int_t uid);
0457    virtual UserGroup_t    *GetUserInfo(const char *user = nullptr);
0458    virtual UserGroup_t    *GetGroupInfo(Int_t gid);
0459    virtual UserGroup_t    *GetGroupInfo(const char *group = nullptr);
0460 
0461    //---- Environment Manipulation
0462    virtual void            Setenv(const char *name, const char *value);
0463    virtual void            Unsetenv(const char *name);
0464    virtual const char     *Getenv(const char *env);
0465 
0466    //---- System Logging
0467    virtual void            Openlog(const char *name, Int_t options, ELogFacility facility);
0468    virtual void            Syslog(ELogLevel level, const char *mess);
0469    virtual void            Closelog();
0470 
0471    //---- Standard Output redirection
0472    virtual Int_t           RedirectOutput(const char *name, const char *mode = "a", RedirectHandle_t *h = nullptr);
0473    virtual void            ShowOutput(RedirectHandle_t *h);
0474 
0475    //---- Dynamic Loading
0476    virtual void            AddDynamicPath(const char *pathname);
0477    virtual const char     *GetDynamicPath();
0478    virtual void            SetDynamicPath(const char *pathname);
0479    char                   *DynamicPathName(const char *lib, Bool_t quiet = kFALSE);
0480    virtual const char     *FindDynamicLibrary(TString& lib, Bool_t quiet = kFALSE);
0481    virtual Func_t          DynFindSymbol(const char *module, const char *entry);
0482    virtual int             Load(const char *module, const char *entry = "", Bool_t system = kFALSE);
0483    virtual void            Unload(const char *module);
0484    virtual UInt_t          LoadAllLibraries();
0485    virtual void            ListSymbols(const char *module, const char *re = "");
0486    virtual void            ListLibraries(const char *regexp = "");
0487    virtual const char     *GetLibraries(const char *regexp = "",
0488                                         const char *option = "",
0489                                         Bool_t isRegexp = kTRUE);
0490 
0491    //---- RPC
0492    virtual TInetAddress    GetHostByName(const char *server);
0493    virtual TInetAddress    GetPeerName(int sock);
0494    virtual TInetAddress    GetSockName(int sock);
0495    virtual int             GetServiceByName(const char *service);
0496    virtual char           *GetServiceByPort(int port);
0497    virtual int             OpenConnection(const char *server, int port, int tcpwindowsize = -1, const char *protocol = "tcp");
0498    virtual int             AnnounceTcpService(int port, Bool_t reuse, int backlog, int tcpwindowsize = -1);
0499    virtual int             AnnounceUdpService(int port, int backlog);
0500    virtual int             AnnounceUnixService(int port, int backlog);
0501    virtual int             AnnounceUnixService(const char *sockpath, int backlog);
0502    virtual int             AcceptConnection(int sock);
0503    virtual void            CloseConnection(int sock, Bool_t force = kFALSE);
0504    virtual int             RecvRaw(int sock, void *buffer, int length, int flag);
0505    virtual int             SendRaw(int sock, const void *buffer, int length, int flag);
0506    virtual int             RecvBuf(int sock, void *buffer, int length);
0507    virtual int             SendBuf(int sock, const void *buffer, int length);
0508    virtual int             SetSockOpt(int sock, int kind, int val);
0509    virtual int             GetSockOpt(int sock, int kind, int *val);
0510 
0511    //---- System, CPU and Memory info
0512    virtual int             GetSysInfo(SysInfo_t *info) const;
0513    virtual int             GetCpuInfo(CpuInfo_t *info, Int_t sampleTime = 1000) const;
0514    virtual int             GetMemInfo(MemInfo_t *info) const;
0515    virtual int             GetProcInfo(ProcInfo_t *info) const;
0516 
0517    //---- ACLiC (Automatic Compiler of Shared Library for CINT)
0518    virtual void            AddIncludePath(const char *includePath);
0519    virtual void            AddLinkedLibs(const char *linkedLib);
0520    virtual int             CompileMacro(const char *filename, Option_t *opt = "", const char *library_name = "", const char *build_dir = "", UInt_t dirmode = 0);
0521    virtual Int_t           GetAclicProperties() const;
0522    virtual const char     *GetBuildArch() const;
0523    virtual const char     *GetBuildCompiler() const;
0524    virtual const char     *GetBuildCompilerVersion() const;
0525    virtual const char     *GetBuildCompilerVersionStr() const;
0526    virtual const char     *GetBuildNode() const;
0527    virtual const char     *GetBuildDir() const;
0528    virtual const char     *GetFlagsDebug() const;
0529    virtual const char     *GetFlagsOpt() const;
0530    virtual const char     *GetIncludePath();
0531    virtual const char     *GetLinkedLibs() const;
0532    virtual const char     *GetLinkdefSuffix() const;
0533    virtual EAclicMode      GetAclicMode() const;
0534    virtual const char     *GetMakeExe() const;
0535    virtual const char     *GetMakeSharedLib() const;
0536    virtual const char     *GetSoExt() const;
0537    virtual const char     *GetObjExt() const;
0538    virtual void            SetBuildDir(const char* build_dir, Bool_t isflat = kFALSE);
0539    virtual void            SetFlagsDebug(const char *);
0540    virtual void            SetFlagsOpt(const char *);
0541    virtual void            SetIncludePath(const char *includePath);
0542    virtual void            SetMakeExe(const char *directives);
0543    virtual void            SetAclicMode(EAclicMode mode);
0544    virtual void            SetMakeSharedLib(const char *directives);
0545    virtual void            SetLinkedLibs(const char *linkedLibs);
0546    virtual void            SetLinkdefSuffix(const char *suffix);
0547    virtual void            SetSoExt(const char *soExt);
0548    virtual void            SetObjExt(const char *objExt);
0549    virtual TString         SplitAclicMode(const char *filename, TString &mode, TString &args, TString &io) const;
0550    virtual void            CleanCompiledMacros();
0551 
0552    ClassDefOverride(TSystem,0)  //ABC defining a generic interface to the OS
0553 };
0554 
0555 R__EXTERN TSystem *gSystem;
0556 R__EXTERN TFileHandler *gXDisplay;  // Display server (X11) input event handler
0557 
0558 
0559 #endif