1    	// @(#)root/base:$Id$
2    	// Author: Fons Rademakers   15/09/95
3    	
4    	/*************************************************************************
5    	 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
6    	 * All rights reserved.                                                  *
7    	 *                                                                       *
8    	 * For the licensing terms see $ROOTSYS/LICENSE.                         *
9    	 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
10   	 *************************************************************************/
11   	
12   	#ifndef ROOT_TSystem
13   	#define ROOT_TSystem
14   	
15   	
16   	//////////////////////////////////////////////////////////////////////////
17   	//                                                                      //
18   	// TSystem                                                              //
19   	//                                                                      //
20   	// Abstract base class defining a generic interface to the underlying   //
21   	// Operating System.                                                    //
22   	//                                                                      //
23   	//////////////////////////////////////////////////////////////////////////
24   	
25   	#ifndef __CINT__
26   	#include <stdio.h>
27   	#include <ctype.h>
28   	#include <fcntl.h>
29   	#ifndef WIN32
30   	#include <unistd.h>
31   	#endif
32   	#endif
33   	
34   	#ifndef ROOT_TNamed
35   	#include "TNamed.h"
36   	#endif
37   	#ifndef ROOT_TString
38   	#include "TString.h"
39   	#endif
40   	#ifndef ROOT_TInetAddress
41   	#include "TInetAddress.h"
42   	#endif
43   	#ifndef ROOT_TTimer
44   	#include "TTimer.h"
45   	#endif
46   	#ifndef ROOT_ThreadLocalStorage
47   	#include "ThreadLocalStorage.h"
48   	#endif
49   	
50   	class TSeqCollection;
51   	class TFdSet;
52   	class TVirtualMutex;
53   	
54   	enum EAccessMode {
55   	   kFileExists        = 0,
56   	   kExecutePermission = 1,
57   	   kWritePermission   = 2,
58   	   kReadPermission    = 4
59   	};
60   	
61   	enum ELogOption {
62   	   kLogPid            = 0x01,
63   	   kLogCons           = 0x02
64   	};
65   	
66   	enum ELogLevel {
67   	   kLogEmerg          = 0,
68   	   kLogAlert          = 1,
69   	   kLogCrit           = 2,
70   	   kLogErr            = 3,
71   	   kLogWarning        = 4,
72   	   kLogNotice         = 5,
73   	   kLogInfo           = 6,
74   	   kLogDebug          = 7
75   	};
76   	
77   	enum ELogFacility {
78   	   kLogLocal0,
79   	   kLogLocal1,
80   	   kLogLocal2,
81   	   kLogLocal3,
82   	   kLogLocal4,
83   	   kLogLocal5,
84   	   kLogLocal6,
85   	   kLogLocal7
86   	};
87   	
88   	enum ESysConstants {
89   	   kMAXSIGNALS       = 15,
90   	   kMAXPATHLEN       = 8192,
91   	   kBUFFERSIZE       = 8192,
92   	   kItimerResolution = 10      // interval-timer resolution in ms
93   	};
94   	
95   	enum EFpeMask {
96   	   kNoneMask         = 0x00,
97   	   kInvalid          = 0x01,  // Invalid argument
98   	   kDivByZero        = 0x02,  // Division by zero
99   	   kOverflow         = 0x04,  // Overflow
100  	   kUnderflow        = 0x08,  // Underflow
101  	   kInexact          = 0x10,  // Inexact
102  	   kDefaultMask      = 0x07,
103  	   kAllMask          = 0x1F
104  	};
105  	
106  	enum EFileModeMask {
107  	   kS_IFMT   = 0170000,   // bitmask for the file type bitfields
108  	   kS_IFSOCK = 0140000,   // socket
109  	   kS_IFLNK  = 0120000,   // symbolic link
110  	   kS_IFOFF  = 0110000,   // offline file
111  	   kS_IFREG  = 0100000,   // regular file
112  	   kS_IFBLK  = 0060000,   // block device
113  	   kS_IFDIR  = 0040000,   // directory
114  	   kS_IFCHR  = 0020000,   // character device
115  	   kS_IFIFO  = 0010000,   // fifo
116  	   kS_ISUID  = 0004000,   // set UID bit
117  	   kS_ISGID  = 0002000,   // set GID bit
118  	   kS_ISVTX  = 0001000,   // sticky bit
119  	   kS_IRWXU  = 00700,     // mask for file owner permissions
120  	   kS_IRUSR  = 00400,     // owner has read permission
121  	   kS_IWUSR  = 00200,     // owner has write permission
122  	   kS_IXUSR  = 00100,     // owner has execute permission
123  	   kS_IRWXG  = 00070,     // mask for group permissions
124  	   kS_IRGRP  = 00040,     // group has read permission
125  	   kS_IWGRP  = 00020,     // group has write permission
126  	   kS_IXGRP  = 00010,     // group has execute permission
127  	   kS_IRWXO  = 00007,     // mask for permissions for others (not in group)
128  	   kS_IROTH  = 00004,     // others have read permission
129  	   kS_IWOTH  = 00002,     // others have write permisson
130  	   kS_IXOTH  = 00001      // others have execute permission
131  	};
132  	
133  	inline Bool_t R_ISDIR(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFDIR); }
134  	inline Bool_t R_ISCHR(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFCHR); }
135  	inline Bool_t R_ISBLK(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFBLK); }
136  	inline Bool_t R_ISREG(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFREG); }
137  	inline Bool_t R_ISLNK(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFLNK); }
138  	inline Bool_t R_ISFIFO(Int_t mode) { return ((mode & kS_IFMT) == kS_IFIFO); }
139  	inline Bool_t R_ISSOCK(Int_t mode) { return ((mode & kS_IFMT) == kS_IFSOCK); }
140  	inline Bool_t R_ISOFF(Int_t mode)  { return ((mode & kS_IFMT) == kS_IFOFF); }
141  	
142  	struct FileStat_t {
143  	   Long_t   fDev;          // device id
144  	   Long_t   fIno;          // inode
145  	   Int_t    fMode;         // protection (combination of EFileModeMask bits)
146  	   Int_t    fUid;          // user id of owner
147  	   Int_t    fGid;          // group id of owner
148  	   Long64_t fSize;         // total size in bytes
149  	   Long_t   fMtime;        // modification date
150  	   Bool_t   fIsLink;       // symbolic link
151  	   TString  fUrl;          // end point url of file
152  	   FileStat_t() : fDev(0), fIno(0), fMode(0), fUid(0), fGid(0), fSize(0),
153  	                  fMtime(0), fIsLink(kFALSE), fUrl("") { }
154  	};
155  	
156  	struct UserGroup_t {
157  	   Int_t    fUid;          // user id
158  	   Int_t    fGid;          // group id
159  	   TString  fUser;         // user name
160  	   TString  fGroup;        // group name
161  	   TString  fPasswd;       // password
162  	   TString  fRealName;     // user full name
163  	   TString  fShell;        // user preferred shell
164  	   UserGroup_t() : fUid(0), fGid(0), fUser(), fGroup(), fPasswd(),
165  	                   fRealName (), fShell() { }
166  	};
167  	
168  	struct SysInfo_t {
169  	   TString   fOS;          // OS
170  	   TString   fModel;       // computer model
171  	   TString   fCpuType;     // type of cpu
172  	   Int_t     fCpus;        // number of cpus
173  	   Int_t     fCpuSpeed;    // cpu speed in MHz
174  	   Int_t     fBusSpeed;    // bus speed in MHz
175  	   Int_t     fL2Cache;     // level 2 cache size in KB
176  	   Int_t     fPhysRam;     // physical RAM in MB
177  	   SysInfo_t() : fOS(), fModel(), fCpuType(), fCpus(0), fCpuSpeed(0),
178  	                 fBusSpeed(0), fL2Cache(0), fPhysRam(0) { }
179  	   virtual ~SysInfo_t() { }
180  	   ClassDef(SysInfo_t, 1); // System information - OS, CPU, RAM.
181  	};
182  	
183  	struct CpuInfo_t {
184  	   Float_t   fLoad1m;      // cpu load average over 1 m
185  	   Float_t   fLoad5m;      // cpu load average over 5 m
186  	   Float_t   fLoad15m;     // cpu load average over 15 m
187  	   Float_t   fUser;        // cpu user load in percentage
188  	   Float_t   fSys;         // cpu sys load in percentage
189  	   Float_t   fTotal;       // cpu user+sys load in percentage
190  	   Float_t   fIdle;        // cpu idle percentage
191  	   CpuInfo_t() : fLoad1m(0), fLoad5m(0), fLoad15m(0),
192  	                 fUser(0), fSys(0), fTotal(0), fIdle(0) { }
193  	   virtual ~CpuInfo_t() { }
194  	   ClassDef(CpuInfo_t, 1); // CPU load information.
195  	};
196  	
197  	struct MemInfo_t {
198  	   Int_t     fMemTotal;    // total RAM in MB
199  	   Int_t     fMemUsed;     // used RAM in MB
200  	   Int_t     fMemFree;     // free RAM in MB
201  	   Int_t     fSwapTotal;   // total swap in MB
202  	   Int_t     fSwapUsed;    // used swap in MB
203  	   Int_t     fSwapFree;    // free swap in MB
204  	   MemInfo_t() : fMemTotal(0), fMemUsed(0), fMemFree(0),
205  	                 fSwapTotal(0), fSwapUsed(0), fSwapFree(0) { }
206  	   virtual ~MemInfo_t() { }
207  	   ClassDef(MemInfo_t, 1); // Memory utilization information.
208  	};
209  	
210  	struct ProcInfo_t {
211  	   Float_t   fCpuUser;     // user time used by this process in seconds
212  	   Float_t   fCpuSys;      // system time used by this process in seconds
213  	   Long_t    fMemResident; // resident memory used by this process in KB
214  	   Long_t    fMemVirtual;  // virtual memory used by this process in KB
215  	   ProcInfo_t() : fCpuUser(0), fCpuSys(0), fMemResident(0),
216  	                  fMemVirtual(0) { }
217  	   virtual ~ProcInfo_t() { }
218  	   ClassDef(ProcInfo_t, 1);// System resource usage of given process.
219  	};
220  	
221  	struct RedirectHandle_t {
222  	   TString   fFile;        // File where the output was redirected
223  	   TString   fStdOutTty;   // tty associated with stdout, if any (e.g. from ttyname(...))
224  	   TString   fStdErrTty;   // tty associated with stderr, if any (e.g. from ttyname(...))
225  	   Int_t     fStdOutDup;   // Duplicated descriptor for stdout
226  	   Int_t     fStdErrDup;   // Duplicated descriptor for stderr
227  	   Int_t     fReadOffSet;  // Offset where to start reading the file (used by ShowOutput(...))
228  	   RedirectHandle_t(const char *n = 0) : fFile(n), fStdOutTty(), fStdErrTty(), fStdOutDup(-1),
229  	                                         fStdErrDup(-1), fReadOffSet(-1) { }
230  	   void Reset() { fFile = ""; fStdOutTty = ""; fStdErrTty = "";
231  	                  fStdOutDup = -1; fStdErrDup = -1; fReadOffSet = -1; }
232  	};
233  	
234  	#ifdef __CINT__
235  	typedef void *Func_t;
236  	#else
237  	typedef void ((*Func_t)());
238  	#endif
239  	
240  	R__EXTERN const char  *gRootDir;
241  	R__EXTERN const char  *gProgName;
242  	R__EXTERN const char  *gProgPath;
243  	R__EXTERN TVirtualMutex *gSystemMutex;
244  	
245  	
246  	//////////////////////////////////////////////////////////////////////////
247  	//                                                                      //
248  	// Asynchronous timer used for processing pending GUI and timer events  //
249  	// every delay ms. Call in a tight computing loop                       //
250  	// TProcessEventTimer::ProcessEvent(). If the timer did timeout this    //
251  	// call will process the pending events and return kTRUE if the         //
252  	// TROOT::IsInterrupted() flag is set (can be done by hitting key in    //
253  	// canvas or selecting canvas menu item View/Interrupt.                 //
254  	//                                                                      //
255  	//////////////////////////////////////////////////////////////////////////
256  	class TProcessEventTimer : public TTimer {
257  	public:
258  	   TProcessEventTimer(Long_t delay);
259  	   Bool_t Notify() { return kTRUE; }
260  	   Bool_t ProcessEvents();
261  	   ClassDef(TProcessEventTimer,0)  // Process pending events at fixed time intervals
262  	};
263  	
264  	
265  	class TSystem : public TNamed {
266  	
267  	public:
268  	   enum EAclicMode { kDefault, kDebug, kOpt };
269  	   enum EAclicProperties {
270  	      kFlatBuildDir = BIT(0)           // If set and a BuildDir is selected, then do not created subdirectories
271  	   };
272  	
273  	protected:
274  	   TFdSet          *fReadmask;         //!Files that should be checked for read events
275  	   TFdSet          *fWritemask;        //!Files that should be checked for write events
276  	   TFdSet          *fReadready;        //!Files with reads waiting
277  	   TFdSet          *fWriteready;       //!Files with writes waiting
278  	   TFdSet          *fSignals;          //!Signals that were trapped
279  	   Int_t            fNfd;              //Number of fd's in masks
280  	   Int_t            fMaxrfd;           //Largest fd in read mask
281  	   Int_t            fMaxwfd;           //Largest fd in write mask
282  	   Int_t            fSigcnt;           //Number of pending signals
283  	   TString          fWdpath;           //Working directory
284  	   TString          fHostname;         //Hostname
285  	   Bool_t           fInsideNotify;     //Used by DispatchTimers()
286  	   Int_t            fBeepFreq;         //Used by Beep()
287  	   Int_t            fBeepDuration;     //Used by Beep()
288  	
289  	   Bool_t           fInControl;        //True if in eventloop
290  	   Bool_t           fDone;             //True if eventloop should be finished
291  	   Int_t            fLevel;            //Level of nested eventloops
292  	
293  	   TSeqCollection  *fTimers;           //List of timers
294  	   TSeqCollection  *fSignalHandler;    //List of signal handlers
295  	   TSeqCollection  *fFileHandler;      //List of file handlers
296  	   TSeqCollection  *fStdExceptionHandler; //List of std::exception handlers
297  	   TSeqCollection  *fOnExitList;       //List of items to be cleaned-up on exit
298  	
299  	   TString          fListLibs;         //List shared libraries, cache used by GetLibraries
300  	
301  	   TString          fBuildArch;        //Architecure for which ROOT was built (passed to ./configure)
302  	   TString          fBuildCompiler;    // Compiler used to build this ROOT
303  	   TString          fBuildCompilerVersion; //Compiler version used to build this ROOT
304  	   TString          fBuildNode;        //Detailed information where ROOT was built
305  	   TString          fBuildDir;         //Location where to build ACLiC shared library and use as scratch area.
306  	   TString          fFlagsDebug;       //Flags for debug compilation
307  	   TString          fFlagsOpt;         //Flags for optimized compilation
308  	   TString          fListPaths;        //List of all include (fIncludePath + interpreter include path). Cache used by GetIncludePath
309  	   TString          fIncludePath;      //Used to expand $IncludePath in the directives given to SetMakeSharedLib and SetMakeExe
310  	   TString          fLinkedLibs;       //Used to expand $LinkedLibs in the directives given to SetMakeSharedLib and SetMakeExe
311  	   TString          fSoExt;            //Extension of shared library (.so, .sl, .a, .dll, etc.)
312  	   TString          fObjExt;           //Extension of object files (.o, .obj, etc.)
313  	   EAclicMode       fAclicMode;        //Whether the compilation should be done debug or opt
314  	   TString          fMakeSharedLib;    //Directive used to build a shared library
315  	   TString          fMakeExe;          //Directive used to build an executable
316  	   TString          fLinkdefSuffix;    //Default suffix for linkdef files to be used by ACLiC (see EACLiCProperties)
317  	   Int_t            fAclicProperties;  //Various boolean flag for change ACLiC's behavior.
318  	   TSeqCollection  *fCompiled;         //List of shared libs from compiled macros to be deleted
319  	   TSeqCollection  *fHelpers;          //List of helper classes for alternative file/directory access
320  	
321  	   TString &GetLastErrorString();             //Last system error message (thread local).
322  	   const TString &GetLastErrorString() const; //Last system error message (thread local).
323  	
324  	   TSystem               *FindHelper(const char *path, void *dirptr = 0);
325  	   virtual Bool_t         ConsistentWith(const char *path, void *dirptr = 0);
326  	   virtual const char    *ExpandFileName(const char *fname);
327  	   virtual void           SigAlarmInterruptsSyscalls(Bool_t) { }
328  	   virtual const char    *GetLinkedLibraries();
329  	   virtual void           DoBeep(Int_t /*freq*/=-1, Int_t /*duration*/=-1) const { printf("\a"); fflush(stdout); }
330  	
331  	   static const char *StripOffProto(const char *path, const char *proto) {
332  	      return !strncmp(path, proto, strlen(proto)) ? path + strlen(proto) : path;
333  	   }
334  	
335  	private:
336  	   TSystem(const TSystem&);              // not implemented
337  	   TSystem& operator=(const TSystem&);   // not implemented
338  	
339  	public:
340  	   TSystem(const char *name = "Generic", const char *title = "Generic System");
341  	   virtual ~TSystem();
342  	
343  	   //---- Misc
344  	   virtual Bool_t          Init();
345  	   virtual void            SetProgname(const char *name);
346  	   virtual void            SetDisplay();
347  	   void                    SetErrorStr(const char *errstr);
348  	   const char             *GetErrorStr() const { return GetLastErrorString(); }
349  	   virtual const char     *GetError();
350  	   void                    RemoveOnExit(TObject *obj);
351  	   virtual const char     *HostName();
352  	   virtual void            NotifyApplicationCreated();
353  	
354  	   static Int_t            GetErrno();
355  	   static void             ResetErrno();
356  	   void                    Beep(Int_t freq=-1, Int_t duration=-1, Bool_t setDefault=kFALSE);
357  	   void                    GetBeepDefaults(Int_t &freq, Int_t &duration) const { freq = fBeepFreq; duration = fBeepDuration; }
358  	
359  	   //---- EventLoop
360  	   virtual void            Run();
361  	   virtual Bool_t          ProcessEvents();
362  	   virtual void            DispatchOneEvent(Bool_t pendingOnly = kFALSE);
363  	   virtual void            ExitLoop();
364  	   Bool_t                  InControl() const { return fInControl; }
365  	   virtual void            InnerLoop();
366  	   virtual Int_t           Select(TList *active, Long_t timeout);
367  	   virtual Int_t           Select(TFileHandler *fh, Long_t timeout);
368  	
369  	   //---- Handling of system events
370  	   virtual void            AddSignalHandler(TSignalHandler *sh);
371  	   virtual TSignalHandler *RemoveSignalHandler(TSignalHandler *sh);
372  	   virtual void            ResetSignal(ESignals sig, Bool_t reset = kTRUE);
373  	   virtual void            ResetSignals();
374  	   virtual void            IgnoreSignal(ESignals sig, Bool_t ignore = kTRUE);
375  	   virtual void            IgnoreInterrupt(Bool_t ignore = kTRUE);
376  	   virtual TSeqCollection *GetListOfSignalHandlers() const { return fSignalHandler; }
377  	   virtual void            AddFileHandler(TFileHandler *fh);
378  	   virtual TFileHandler   *RemoveFileHandler(TFileHandler *fh);
379  	   virtual TSeqCollection *GetListOfFileHandlers() const { return fFileHandler; }
380  	   virtual void            AddStdExceptionHandler(TStdExceptionHandler *eh);
381  	   virtual TStdExceptionHandler *RemoveStdExceptionHandler(TStdExceptionHandler *eh);
382  	   virtual TSeqCollection *GetListOfStdExceptionHandlers() const { return fStdExceptionHandler; }
383  	
384  	   //---- Floating Point Exceptions Control
385  	   virtual Int_t           GetFPEMask();
386  	   virtual Int_t           SetFPEMask(Int_t mask = kDefaultMask);
387  	
388  	   //---- Time & Date
389  	   virtual TTime           Now();
390  	   virtual TSeqCollection *GetListOfTimers() const { return fTimers; }
391  	   virtual void            AddTimer(TTimer *t);
392  	   virtual TTimer         *RemoveTimer(TTimer *t);
393  	   virtual void            ResetTimer(TTimer *) { }
394  	   virtual Long_t          NextTimeOut(Bool_t mode);
395  	   virtual void            Sleep(UInt_t milliSec);
396  	
397  	   //---- Processes
398  	   virtual Int_t           Exec(const char *shellcmd);
399  	   virtual FILE           *OpenPipe(const char *command, const char *mode);
400  	   virtual int             ClosePipe(FILE *pipe);
401  	   virtual TString         GetFromPipe(const char *command);
402  	   virtual void            Exit(int code, Bool_t mode = kTRUE);
403  	   virtual void            Abort(int code = 0);
404  	   virtual int             GetPid();
405  	   virtual void            StackTrace();
406  	
407  	   //---- Directories
408  	   virtual int             MakeDirectory(const char *name);
409  	   virtual void           *OpenDirectory(const char *name);
410  	   virtual void            FreeDirectory(void *dirp);
411  	   virtual const char     *GetDirEntry(void *dirp);
412  	   virtual void           *GetDirPtr() const { return 0; }
413  	   virtual Bool_t          ChangeDirectory(const char *path);
414  	   virtual const char     *WorkingDirectory();
415  	   virtual const char     *HomeDirectory(const char *userName = 0);
416  	   virtual int             mkdir(const char *name, Bool_t recursive = kFALSE);
417  	   Bool_t                  cd(const char *path) { return ChangeDirectory(path); }
418  	   const char             *pwd() { return WorkingDirectory(); }
419  	   virtual const char     *TempDirectory() const;
420  	   virtual FILE           *TempFileName(TString &base, const char *dir = 0);
421  	
422  	   //---- Paths & Files
423  	   virtual const char     *BaseName(const char *pathname);
424  	   virtual const char     *DirName(const char *pathname);
425  	   virtual char           *ConcatFileName(const char *dir, const char *name);
426  	   virtual Bool_t          IsAbsoluteFileName(const char *dir);
427  	   virtual Bool_t          IsFileInIncludePath(const char *name, char **fullpath = 0);
428  	   virtual const char     *PrependPathName(const char *dir, TString& name);
429  	   virtual Bool_t          ExpandPathName(TString &path);
430  	   virtual char           *ExpandPathName(const char *path);
431  	   virtual Bool_t          AccessPathName(const char *path, EAccessMode mode = kFileExists);
432  	   virtual Bool_t          IsPathLocal(const char *path);
433  	   virtual int             CopyFile(const char *from, const char *to, Bool_t overwrite = kFALSE);
434  	   virtual int             Rename(const char *from, const char *to);
435  	   virtual int             Link(const char *from, const char *to);
436  	   virtual int             Symlink(const char *from, const char *to);
437  	   virtual int             Unlink(const char *name);
438  	   int                     GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime);
439  	   int                     GetPathInfo(const char *path, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime);
440  	   virtual int             GetPathInfo(const char *path, FileStat_t &buf);
441  	   virtual int             GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree);
442  	   virtual int             Chmod(const char *file, UInt_t mode);
443  	   virtual int             Umask(Int_t mask);
444  	   virtual int             Utime(const char *file, Long_t modtime, Long_t actime);
445  	   virtual const char     *UnixPathName(const char *unixpathname);
446  	   virtual const char     *FindFile(const char *search, TString& file, EAccessMode mode = kFileExists);
447  	   virtual char           *Which(const char *search, const char *file, EAccessMode mode = kFileExists);
448  	   virtual TList          *GetVolumes(Option_t *) const { return 0; }
449  	
450  	   //---- Users & Groups
451  	   virtual Int_t           GetUid(const char *user = 0);
452  	   virtual Int_t           GetGid(const char *group = 0);
453  	   virtual Int_t           GetEffectiveUid();
454  	   virtual Int_t           GetEffectiveGid();
455  	   virtual UserGroup_t    *GetUserInfo(Int_t uid);
456  	   virtual UserGroup_t    *GetUserInfo(const char *user = 0);
457  	   virtual UserGroup_t    *GetGroupInfo(Int_t gid);
458  	   virtual UserGroup_t    *GetGroupInfo(const char *group = 0);
459  	
460  	   //---- Environment Manipulation
461  	   virtual void            Setenv(const char *name, const char *value);
462  	   virtual void            Unsetenv(const char *name);
463  	   virtual const char     *Getenv(const char *env);
464  	
465  	   //---- System Logging
466  	   virtual void            Openlog(const char *name, Int_t options, ELogFacility facility);
467  	   virtual void            Syslog(ELogLevel level, const char *mess);
468  	   virtual void            Closelog();
469  	
470  	   //---- Standard Output redirection
471  	   virtual Int_t           RedirectOutput(const char *name, const char *mode = "a", RedirectHandle_t *h = 0);
472  	   virtual void            ShowOutput(RedirectHandle_t *h);
473  	
474  	   //---- Dynamic Loading
475  	   virtual void            AddDynamicPath(const char *pathname);
476  	   virtual const char     *GetDynamicPath();
477  	   virtual void            SetDynamicPath(const char *pathname);
478  	   virtual char           *DynamicPathName(const char *lib, Bool_t quiet = kFALSE);
479  	   virtual Func_t          DynFindSymbol(const char *module, const char *entry);
480  	   virtual int             Load(const char *module, const char *entry = "", Bool_t system = kFALSE);
481  	   virtual void            Unload(const char *module);
482  	   virtual void            ListSymbols(const char *module, const char *re = "");
483  	   virtual void            ListLibraries(const char *regexp = "");
484  	   virtual const char     *GetLibraries(const char *regexp = "",
485  	                                        const char *option = "",
486  	                                        Bool_t isRegexp = kTRUE);
487  	
488  	   //---- RPC
489  	   virtual TInetAddress    GetHostByName(const char *server);
490  	   virtual TInetAddress    GetPeerName(int sock);
491  	   virtual TInetAddress    GetSockName(int sock);
492  	   virtual int             GetServiceByName(const char *service);
493  	   virtual char           *GetServiceByPort(int port);
494  	   virtual int             OpenConnection(const char *server, int port, int tcpwindowsize = -1, const char *protocol = "tcp");
495  	   virtual int             AnnounceTcpService(int port, Bool_t reuse, int backlog, int tcpwindowsize = -1);
496  	   virtual int             AnnounceUdpService(int port, int backlog);
497  	   virtual int             AnnounceUnixService(int port, int backlog);
498  	   virtual int             AnnounceUnixService(const char *sockpath, int backlog);
499  	   virtual int             AcceptConnection(int sock);
500  	   virtual void            CloseConnection(int sock, Bool_t force = kFALSE);
501  	   virtual int             RecvRaw(int sock, void *buffer, int length, int flag);
502  	   virtual int             SendRaw(int sock, const void *buffer, int length, int flag);
503  	   virtual int             RecvBuf(int sock, void *buffer, int length);
504  	   virtual int             SendBuf(int sock, const void *buffer, int length);
505  	   virtual int             SetSockOpt(int sock, int kind, int val);
506  	   virtual int             GetSockOpt(int sock, int kind, int *val);
507  	
508  	   //---- System, CPU and Memory info
509  	   virtual int             GetSysInfo(SysInfo_t *info) const;
510  	   virtual int             GetCpuInfo(CpuInfo_t *info, Int_t sampleTime = 1000) const;
511  	   virtual int             GetMemInfo(MemInfo_t *info) const;
512  	   virtual int             GetProcInfo(ProcInfo_t *info) const;
513  	
514  	   //---- ACLiC (Automatic Compiler of Shared Library for CINT)
515  	   virtual void            AddIncludePath(const char *includePath);
516  	   virtual void            AddLinkedLibs(const char *linkedLib);
517  	   virtual int             CompileMacro(const char *filename, Option_t *opt="", const char* library_name = "", const char* build_dir = "", UInt_t dirmode = 0);
518  	   virtual Int_t           GetAclicProperties() const;
519  	   virtual const char     *GetBuildArch() const;
520  	   virtual const char     *GetBuildCompiler() const;
521  	   virtual const char     *GetBuildCompilerVersion() const;
522  	   virtual const char     *GetBuildNode() const;
523  	   virtual const char     *GetBuildDir() const;
524  	   virtual const char     *GetFlagsDebug() const;
525  	   virtual const char     *GetFlagsOpt() const;
526  	   virtual const char     *GetIncludePath();
527  	   virtual const char     *GetLinkedLibs() const;
528  	   virtual const char     *GetLinkdefSuffix() const;
529  	   virtual EAclicMode      GetAclicMode() const;
530  	   virtual const char     *GetMakeExe() const;
531  	   virtual const char     *GetMakeSharedLib() const;
532  	   virtual const char     *GetSoExt() const;
533  	   virtual const char     *GetObjExt() const;
534  	   virtual void            SetBuildDir(const char* build_dir, Bool_t isflat = kFALSE);
535  	   virtual void            SetFlagsDebug(const char *);
536  	   virtual void            SetFlagsOpt(const char *);
537  	   virtual void            SetIncludePath(const char *includePath);
538  	   virtual void            SetMakeExe(const char *directives);
539  	   virtual void            SetAclicMode(EAclicMode mode);
540  	   virtual void            SetMakeSharedLib(const char *directives);
541  	   virtual void            SetLinkedLibs(const char *linkedLibs);
542  	   virtual void            SetLinkdefSuffix(const char *suffix);
543  	   virtual void            SetSoExt(const char *soExt);
544  	   virtual void            SetObjExt(const char *objExt);
545  	   virtual TString         SplitAclicMode(const char *filename, TString &mode, TString &args, TString &io) const;
546  	   virtual void            CleanCompiledMacros();
547  	
548  	   ClassDef(TSystem,0)  //ABC defining a generic interface to the OS
549  	};
550  	
551  	R__EXTERN TSystem *gSystem;
552  	R__EXTERN TFileHandler *gXDisplay;  // Display server (X11) input event handler
553  	
554  	
555  	#endif
556