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 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include <sys/types.h>
34 #include <sys/stat.h>
35 
36 class XrdSysError;
37 class XrdOucStream;
38 
40 {
41 public:
42 
43 static const mode_t pathMode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
44 
45 static char *eText(int rc, char *eBuff, int eBlen, int AsIs=0);
46 
47 static int doIf(XrdSysError *eDest, XrdOucStream &Config,
48  const char *what, const char *hname,
49  const char *nname, const char *pname);
50 
51 static int fmtBytes(long long val, char *buff, int bsz);
52 
53 static char *genPath(const char *path, const char *inst, const char *psfx=0);
54 
55 static int genPath(char *buff, int blen, const char *path, const char *psfx=0);
56 
57 static int GroupName(gid_t gID, char *gName, int gNsz);
58 
59 static char *Ident(long long &mySID, char *iBuff, int iBlen,
60  const char *iHost, const char *iProg, const char *iName,
61  int Port);
62 
63 static const char *InstName(int TranOpt=0);
64 
65 static const char *InstName(const char *name, int Fillit=1);
66 
67 static int is1of(char *val, const char **clist);
68 
69 static void makeHome(XrdSysError &eDest, const char *inst);
70 
71 static int makePath(char *path, mode_t mode);
72 
73 static char *subLogfn(XrdSysError &eDest, const char *inst, char *logfn);
74 
75 static void Undercover(XrdSysError &eDest, int noLog, int *pipeFD = 0);
76 
77 static int UserName(uid_t uID, char *uName, int uNsz);
78 
79 static bool PidFile(XrdSysError &eDest, const char *path);
80 
83 };
84 #endif
static void Undercover(XrdSysError &eDest, int noLog, int *pipeFD=0)
static int doIf(XrdSysError *eDest, XrdOucStream &Config, const char *what, const char *hname, const char *nname, const char *pname)
static int fmtBytes(long long val, char *buff, int bsz)
Definition: XrdOucStream.hh:43
static char * eText(int rc, char *eBuff, int eBlen, int AsIs=0)
static void makeHome(XrdSysError &eDest, const char *inst)
static bool PidFile(XrdSysError &eDest, const char *path)
~XrdOucUtils()
Definition: XrdOucUtils.hh:82
Definition: XrdSysError.hh:87
static int makePath(char *path, mode_t mode)
static const char * InstName(int TranOpt=0)
static const mode_t pathMode
Definition: XrdOucUtils.hh:43
XrdOucUtils()
Definition: XrdOucUtils.hh:81
static int UserName(uid_t uID, char *uName, int uNsz)
static char * subLogfn(XrdSysError &eDest, const char *inst, char *logfn)
static int is1of(char *val, const char **clist)
static char * Ident(long long &mySID, char *iBuff, int iBlen, const char *iHost, const char *iProg, const char *iName, int Port)
static char * genPath(const char *path, const char *inst, const char *psfx=0)
Definition: XrdOucUtils.hh:39
static int GroupName(gid_t gID, char *gName, int gNsz)