Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 09:09:38

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