xrootd
|
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 // $Id$ 00014 00015 #include <sys/types.h> 00016 #include <sys/stat.h> 00017 00018 class XrdSysError; 00019 class XrdOucStream; 00020 00021 class XrdOucUtils 00022 { 00023 public: 00024 00025 static const mode_t pathMode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; 00026 00027 static char *eText(int rc, char *eBuff, int eBlen, int AsIs=0); 00028 00029 static int doIf(XrdSysError *eDest, XrdOucStream &Config, 00030 const char *what, const char *hname, 00031 const char *nname, const char *pname); 00032 00033 static int fmtBytes(long long val, char *buff, int bsz); 00034 00035 static char *genPath(const char *path, const char *inst, const char *psfx=0); 00036 00037 static int genPath(char *buff, int blen, const char *path, const char *psfx=0); 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 bool PidFile(XrdSysError &eDest, const char *path); 00054 00055 XrdOucUtils() {} 00056 ~XrdOucUtils() {} 00057 }; 00058 #endif