xrootd
XrdOucUtils.hh
Go to the documentation of this file.
00001 #ifndef __XRDOUCUTILS_HH__
00002 #define __XRDOUCUTILS_HH__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                        X r d O u c U t i l s . h h                         */
00006 /*                                                                            */
00007 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*                            All Rights Reserved                             */
00009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00011 /******************************************************************************/
00012 
00013 #include <sys/types.h>
00014 #include <sys/stat.h>
00015   
00016 class XrdSysError;
00017 class XrdOucStream;
00018 
00019 class XrdOucUtils
00020 {
00021 public:
00022 
00023 static const mode_t pathMode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
00024 
00025 static char *eText(int rc, char *eBuff, int eBlen, int AsIs=0);
00026 
00027 static int   doIf(XrdSysError *eDest, XrdOucStream &Config,
00028                   const char *what, const char *hname, 
00029                                     const char *nname, const char *pname);
00030  
00031 static int   fmtBytes(long long val, char *buff, int bsz);
00032 
00033 static char *genPath(const char *path, const char *inst, const char *psfx=0);
00034 
00035 static int   genPath(char *buff, int blen, const char *path, const char *psfx=0);
00036 
00037 static int   GroupName(gid_t gID, char *gName, int gNsz);
00038 
00039 static const char *InstName(int TranOpt=0);
00040 
00041 static const char *InstName(const char *name, int Fillit=1);
00042 
00043 static int   is1of(char *val, const char **clist);
00044 
00045 static void  makeHome(XrdSysError &eDest, const char *inst);
00046 
00047 static int   makePath(char *path, mode_t mode);
00048  
00049 static char *subLogfn(XrdSysError &eDest, const char *inst, char *logfn);
00050 
00051 static void  Undercover(XrdSysError &eDest, int noLog, int *pipeFD = 0);
00052 
00053 static int   UserName(uid_t uID, char *uName, int uNsz);
00054 
00055 static bool PidFile(XrdSysError &eDest, const char *path);
00056 
00057        XrdOucUtils() {}
00058       ~XrdOucUtils() {}
00059 };
00060 #endif