xrootd
XrdOucUtils.hh
Go to the documentation of this file.
1 #ifndef __XRDOUCUTILS_HH__
2 #define __XRDOUCUTILS_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d O u c U t i l s . h h */
6 /* */
7 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /******************************************************************************/
12 
13 #include <sys/types.h>
14 #include <sys/stat.h>
15 
16 class XrdSysError;
17 class XrdOucStream;
18 
20 {
21 public:
22 
23 static const mode_t pathMode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
24 
25 static char *eText(int rc, char *eBuff, int eBlen, int AsIs=0);
26 
28  const char *what, const char *hname,
29  const char *nname, const char *pname);
30 
31 static int fmtBytes(long long val, char *buff, int bsz);
32 
33 static char *genPath(const char *path, const char *inst, const char *psfx=0);
34 
35 static int genPath(char *buff, int blen, const char *path, const char *psfx=0);
36 
37 static int GroupName(gid_t gID, char *gName, int gNsz);
38 
39 static char *Ident(long long &mySID, char *iBuff, int iBlen,
40  const char *iHost, const char *iProg, const char *iName,
41  int Port);
42 
43 static const char *InstName(int TranOpt=0);
44 
45 static const char *InstName(const char *name, int Fillit=1);
46 
47 static int is1of(char *val, const char **clist);
48 
49 static void makeHome(XrdSysError &eDest, const char *inst);
50 
51 static int makePath(char *path, mode_t mode);
52 
53 static char *subLogfn(XrdSysError &eDest, const char *inst, char *logfn);
54 
55 static void Undercover(XrdSysError &eDest, int noLog, int *pipeFD = 0);
56 
57 static int UserName(uid_t uID, char *uName, int uNsz);
58 
59 static bool PidFile(XrdSysError &eDest, const char *path);
60 
63 };
64 #endif