Logo ROOT  
Reference Guide
XrdProofdAux.h
Go to the documentation of this file.
1 // @(#)root/proofd:$Id$
2 // Author: G. Ganis June 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, 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_XrdProofdAux
13 #define ROOT_XrdProofdAux
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // XrdProofdAux //
18 // //
19 // Authors: G. Ganis, CERN, 2007 //
20 // //
21 // Small auxiliary classes used in XrdProof //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 #include <list>
25 #include <map>
26 #include <stdarg.h>
27 
28 #include "XpdSysSemWait.h"
29 
30 #include "Xrd/XrdProtocol.hh"
31 #include "XProofProtocol.h"
32 #include "XrdOuc/XrdOucHash.hh"
33 #include "XrdOuc/XrdOucString.hh"
34 
35 //
36 // User Info class
37 //
38 class XrdProofUI {
39 public:
40  XrdOucString fUser; // User name
41  XrdOucString fGroup; // PROOF group name
42  XrdOucString fHomeDir; // Unix home
43  int fUid; // Unix user ID
44  int fGid; // Unix group ID
45 
46  XrdProofUI() { fUid = -1; fGid = -1; }
47  XrdProofUI(const XrdProofUI &) = default;
49 
50  void Reset() { fUser = ""; fHomeDir = ""; fGroup = ""; fUid = -1; fGid = -1; }
51 };
52 
53 //
54 // Group Info class
55 //
56 class XrdProofGI {
57 public:
58  XrdOucString fGroup;
59  int fGid;
60 
61  XrdProofGI() { fGid = -1; }
62  XrdProofGI(const XrdProofGI &gi) { fGroup = gi.fGroup; fGid = gi.fGid; }
64 
65  void Reset() { fGroup = ""; fGid = -1; }
66 };
67 
68 //
69 // File container (e.g. for config files)
70 //
72 public:
73  XrdOucString fName; // File name
74  time_t fMtime; // File mofification time last time we accessed it
75  XrdProofdFile(const char *fn = 0, time_t mtime = 0) : fName(fn), fMtime(mtime) { }
76 };
77 
78 //
79 // User priority
80 //
82 public:
83  XrdOucString fUser; // User to who this applies (wild cards accepted)
84  int fDeltaPriority; // Priority change
85  XrdProofdPriority(const char *usr, int dp) : fUser(usr), fDeltaPriority(dp) { }
86 };
87 
88 //
89 // Small class to describe a process
90 //
92 public:
93  int pid;
94  XrdOucString pname;
95  XrdProofdPInfo(int i, const char *n) : pid(i) { pname = n; }
96 };
97 
98 //
99 // Class to handle configuration directives
100 //
101 class XrdProofdDirective;
102 class XrdOucStream;
104  XrdOucStream *cfg, bool reconfig);
106 public:
107  void *fVal;
108  XrdOucString fName;
110  bool fRcf;
111  const char *fHost; // needed to support old 'if' construct
112 
113  XrdProofdDirective(const char *n, void *v, XrdFunDirective_t f, bool rcf = 1) :
114  fVal(v), fName(n), fFun(f), fRcf(rcf), fHost(0) { }
115 
116  int DoDirective(char *val, XrdOucStream *cfg, bool reconfig)
117  { return (*fFun)(this, val, cfg, reconfig); }
118 };
119 // Function of general interest
120 int DoDirectiveClass(XrdProofdDirective *, char *val, XrdOucStream *cfg, bool rcf);
121 int DoDirectiveInt(XrdProofdDirective *, char *val, XrdOucStream *cfg, bool rcf);
122 int DoDirectiveString(XrdProofdDirective *, char *val, XrdOucStream *cfg, bool rcf);
123 // To set the host field in a loop over the hash list
124 int SetHostInDirectives(const char *, XrdProofdDirective *d, void *h);
125 
126 //
127 // Class to handle condensed multi-string specification, e.g <head>[01-25]<tail>
128 //
130 private:
131  long fIa;
132  long fIb;
133  XrdOucString fA;
134  XrdOucString fB;
135  int fType;
136  int fN; // Number of combinations
137 
138  void Init(const char *s);
139 public:
141 
142  XrdProofdMultiStrToken(const char *s = 0) { Init(s); }
144 
145  XrdOucString Export(int &next);
146  bool IsValid() const { return (fType == kUndef) ? 0 : 1; }
147  bool Matches(const char *s);
148  int N() const { return fN; }
149 };
150 
152 private:
153  XrdOucString fHead;
154  XrdOucString fTail;
155  std::list<XrdProofdMultiStrToken> fTokens;
156  int fN; // Number of combinations
157 
158  void Init(const char *s);
159 public:
160  XrdProofdMultiStr(const char *s) { Init(s); }
161  virtual ~XrdProofdMultiStr() { }
162 
163  XrdOucString Get(int i);
164  bool IsValid() const { return (fTokens.size() > 0 ? 1 : 0); }
165  bool Matches(const char *s);
166  int N() const { return fN; }
167 
168  XrdOucString Export();
169 };
170 
171 //
172 // Class to handle message buffers received via a pipe
173 //
174 class XpdMsg {
175  int fType;
176  XrdOucString fBuf;
177  int fFrom;
178 public:
179  XpdMsg(const char *buf = 0) { Init(buf); }
180  virtual ~XpdMsg() { }
181 
182  const char *Buf() const {return fBuf.c_str(); }
183 
184  int Init(const char *buf);
185  void Reset() { fFrom = 0; }
186 
187  int Get(int &i);
188  int Get(XrdOucString &s);
189  int Get(void **p);
190 
191  int Type() const { return fType; }
192 };
193 
194 //
195 // Class describing a pipe
196 //
198  XrdSysRecMutex fRdMtx; // Mutex for read operations
199  XrdSysRecMutex fWrMtx; // Mutex for write operations
200  int fPipe[2]; // pipe descriptors
201 public:
202  XrdProofdPipe();
203  virtual ~XrdProofdPipe();
204 
205  void Close();
206  bool IsValid() const { return (fPipe[0] > 0 && fPipe[1] > 0) ? 1 : 0; }
207 
208  int Poll(int to = -1);
209 
210  int Post(int type, const char *msg);
211  int Recv(XpdMsg &msg);
212 };
213 
214 //
215 // Container for DS information
216 //
218 public:
219  XrdOucString fType; // Backend type
220  XrdOucString fUrl; // URL from where to take the information
221  bool fLocal; // TRUE if on the local file system
222  bool fRW; // TRUE if users can modify their area
223  XrdOucString fOpts; // Options for this source
224  XrdOucString fObscure; // Obscure options to pass through
225  XrdProofdDSInfo(const char *t, const char *u, bool local, bool rw,
226  const char *o = "Ar:Av:", const char *obscure = "") :
227  fType(t), fUrl(u), fLocal(local), fRW(rw), fOpts(o),
228  fObscure(obscure) { }
229  XrdOucString ToString() const {
230  return "Type=" + fType + "; URL=" + fUrl +
231  "; Local=" + (fLocal ? "Yes" : "No") +
232  "; RW=" + (fRW ? "Yes" : "No") + "; Options=" + fOpts +
233  "; Obscure=" + fObscure;
234  }
235 };
236 
237 //
238 // Static methods
239 //
240 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
241 typedef struct kinfo_proc kinfo_proc;
242 #endif
243 class XrdOucStream;
246 public:
248 
249  static const char *AdminMsgType(int type);
250  static int AssertBaseDir(const char *path, XrdProofUI ui);
251  static int AssertDir(const char *path, XrdProofUI ui, bool changeown);
252  static int ChangeMod(const char *path, unsigned int mode);
253  static int ChangeOwn(const char *path, XrdProofUI ui);
254  static int ChangeToDir(const char *dir, XrdProofUI ui, bool changeown);
255  static int CheckIf(XrdOucStream *s, const char *h);
256  static char *Expand(char *p);
257  static void Expand(XrdOucString &path);
258  // String form functions
259  static void Form(XrdOucString &s, const char *fmt, int ns, const char *ss[5], int ni, int ii[6],
260  int np, void *pp[5], int nu = 0, unsigned int ui = 0);
261  static void Form(XrdOucString &s, const char *fmt, const char *s0, const char *s1 = 0,
262  const char *s2 = 0, const char *s3 = 0, const char *s4 = 0);
263  static void Form(XrdOucString &s, const char *fmt, int i0, int i1 = 0, int i2 = 0,
264  int i3 = 0, int i4 = 0, int i5 = 0);
265  static void Form(XrdOucString &s, const char *fmt, void *p0, void *p1 = 0, void *p2 = 0,
266  void *p3 = 0, void *p4 = 0);
267  static void Form(XrdOucString &s, const char *fmt, int i0, const char *s0,
268  const char *s1 = 0, const char *s2 = 0, const char *s3 = 0);
269  static void Form(XrdOucString &s, const char *fmt, const char *s0,
270  int i0, int i1 = 0, int i2 = 0, int i3 = 0);
271  static void Form(XrdOucString &s, const char *fmt, const char *s0,
272  int i0, int i1, unsigned int u1);
273  static void Form(XrdOucString &s, const char *fmt, const char *s0, const char *s1,
274  int i0, int i1, int i2);
275  static void Form(XrdOucString &s, const char *fmt, int i0, int i1,
276  const char *s0, const char *s1, const char *s2);
277  static void Form(XrdOucString &s, const char *fmt, const char *s0, const char *s1,
278  const char *s2, int i0, int i1 = 0,
279  const char *s3 = 0, const char *s4 = 0);
280  static void Form(XrdOucString &s, const char *fmt, const char *s0, int i0, int i1,
281  const char *s1, const char *s2,
282  const char *s3);
283  static void Form(XrdOucString &s, const char *fmt, const char *s0, const char *s1,
284  const char *s2, int i0, unsigned int u1);
285  static void Form(XrdOucString &s, const char *fmt, int i0, int i1, int i2,
286  const char *s0, const char *s1);
287 
288  static void Form(XrdOucString &s, const char *fmt, const char *s0, const char *s1, const char *s2,
289  const char *s3, int i1);
290  static void Form(XrdOucString &s, const char *fmt, int i0, int i1, int i2, int i3, const char *s0);
291 
292  static void Form(XrdOucString &s, const char *fmt, int i0, int i1, void *p0);
293  static void Form(XrdOucString &s, const char *fmt, int i0, int i1, int i2, void *p0);
294  static void Form(XrdOucString &s, const char *fmt, int i0, int i1, int i2, int i3, void *p0);
295  static void Form(XrdOucString &s, const char *fmt, int i0, int i1, void *p0, int i2, int i3 = 0);
296  static void Form(XrdOucString &s, const char *fmt, void *p0, int i0, int i1);
297  static void Form(XrdOucString &s, const char *fmt, const char *s0, void *p0, int i0, int i1);
298  static void Form(XrdOucString &s, const char *fmt, void *p0, const char *s0, int i0);
299  static void Form(XrdOucString &s, const char *fmt, const char *s0, const char *s1, void *p0);
300  static void Form(XrdOucString &s, const char *fmt, int i0, const char *s0, const char *s1,
301  int i1, int i2 = 0);
302  static void Form(XrdOucString &s, const char *fmt, int i0, const char *s0, int i1, int i2 = 0);
303 
304  static int GetIDFromPath(const char *path, XrdOucString &emsg);
305  static long int GetLong(char *str);
306 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
307  static int GetMacProcList(kinfo_proc **plist, int &nproc);
308 #endif
309  static int GetNumCPUs();
310  static int GetGroupInfo(const char *grp, XrdProofGI &gi);
311  static int GetGroupInfo(int gid, XrdProofGI &gi);
312  static int GetProcesses(const char *pn, std::map<int,XrdOucString> *plist);
313  static int GetUserInfo(const char *usr, XrdProofUI &ui);
314  static int GetUserInfo(int uid, XrdProofUI &ui);
315  static bool HasToken(const char *s, const char *tokens);
316  static int KillProcess(int pid, bool forcekill, XrdProofUI ui, bool changeown);
317  static void LogEmsgToFile(const char *flog, const char *emsg, const char *pfx = 0);
318  static int MvDir(const char *oldpath, const char *newpath);
319  static int ParsePidPath(const char *path, XrdOucString &before, XrdOucString &after);
320  static int ParseUsrGrp(const char *path, XrdOucString &usr, XrdOucString &grp);
321  static const char *ProofRequestTypes(int type);
322  static int ReadMsg(int fd, XrdOucString &msg);
323  static int RmDir(const char *path);
324  static int SymLink(const char *path, const char *link);
325  static int Touch(const char *path, int opt = 0);
326  static int VerifyProcessByID(int pid, const char *pname = "proofserv");
327  static int Write(int fd, const void *buf, size_t nb);
328 };
329 
330 // Useful definitions
331 #ifndef SafeDel
332 #define SafeDel(x) { if (x) { delete x; x = 0; } }
333 #endif
334 #ifndef SafeDelArray
335 #define SafeDelArray(x) { if (x) { delete[] x; x = 0; } }
336 #endif
337 #ifndef SafeFree
338 #define SafeFree(x) { if (x) free(x); x = 0; }
339 #endif
340 
341 #ifndef INRANGE
342 #define INRANGE(x,y) ((x >= 0) && (x < (int)y->size()))
343 #endif
344 
345 #ifndef DIGIT
346 #define DIGIT(x) (x >= 48 && x <= 57)
347 #endif
348 
349 #ifndef LETTOIDX
350 #define LETTOIDX(x, ilet) \
351  if (x >= 97 && x <= 122) ilet = x - 96; \
352  if (x >= 65 && x <= 90) ilet = x - 38;
353 #endif
354 #ifndef IDXTOLET
355 #define IDXTOLET(ilet, x) \
356  if ((ilet) >= 1 && (ilet) <= 26) x = (ilet) + 96; \
357  if ((ilet) >= 27 && (ilet) <= 52) x = (ilet) + 38;
358 #endif
359 
360 #ifndef XPDSWAP
361 #define XPDSWAP(a,b,t) { t = a ; a = b; b = t; }
362 #endif
363 
364 #ifndef XpdBadPGuard
365 #define XpdBadPGuard(g,u) (!(g.Valid()) && (geteuid() != (uid_t)u))
366 #endif
367 
368 #undef MHEAD
369 #define MHEAD "--- Proofd: "
370 
371 #undef TRACELINK
372 #define TRACELINK fLink
373 
374 #undef RESPONSE
375 #define RESPONSE fResponse
376 
377 #ifndef XPDFORM
378 #define XPDFORM XrdProofdAux::Form
379 #endif
380 
381 #endif
XrdFunDirective_t
int(* XrdFunDirective_t)(XrdProofdDirective *, char *, XrdOucStream *cfg, bool reconfig)
Definition: XrdProofdAux.h:103
XrdProofdMultiStrToken::N
int N() const
Definition: XrdProofdAux.h:148
XrdProofdAux::ProofRequestTypes
static const char * ProofRequestTypes(int type)
Translates the proof request type in a human readable string.
Definition: XrdProofdAux.cxx:70
XrdProofdDSInfo::fObscure
XrdOucString fObscure
Definition: XrdProofdAux.h:224
n
const Int_t n
Definition: legend1.C:16
XrdProofdAux::GetIDFromPath
static int GetIDFromPath(const char *path, XrdOucString &emsg)
Extract an integer from a file.
Definition: XrdProofdAux.cxx:1110
XrdProofdFile::fName
XrdOucString fName
Definition: XrdProofdAux.h:73
XrdProofdPipe::fPipe
int fPipe[2]
Definition: XrdProofdAux.h:200
XpdMsg::Get
int Get(int &i)
Get next token and interpret it as an int.
Definition: XrdProofdAux.cxx:1886
XrdProofUI::fUid
int fUid
Definition: XrdProofdAux.h:49
XrdProofGI::XrdProofGI
XrdProofGI(const XrdProofGI &gi)
Definition: XrdProofdAux.h:62
XrdProofdMultiStr::~XrdProofdMultiStr
virtual ~XrdProofdMultiStr()
Definition: XrdProofdAux.h:161
XrdProofdDSInfo::XrdProofdDSInfo
XrdProofdDSInfo(const char *t, const char *u, bool local, bool rw, const char *o="Ar:Av:", const char *obscure="")
Definition: XrdProofdAux.h:225
XrdProofdMultiStrToken::fType
int fType
Definition: XrdProofdAux.h:135
f
#define f(i)
Definition: RSha256.hxx:122
XrdProofdDSInfo::fRW
bool fRW
Definition: XrdProofdAux.h:222
XrdProofdAux::Touch
static int Touch(const char *path, int opt=0)
Set access (opt == 1), modify (opt =2 ) or access&modify (opt = 0, default) times of path to current ...
Definition: XrdProofdAux.cxx:1486
changeown
int changeown(const std::string &path, uid_t u, gid_t g)
Change the ownership of 'path' to the entity described by {u,g}.
Definition: proofexecv.cxx:738
XrdProofdPipe::IsValid
bool IsValid() const
Definition: XrdProofdAux.h:206
XrdProofdPipe::Poll
int Poll(int to=-1)
Poll over the read pipe for to secs; return whatever poll returns.
Definition: XrdProofdAux.cxx:1814
XrdProofdPipe
Definition: XrdProofdAux.h:197
DoDirectiveInt
int DoDirectiveInt(XrdProofdDirective *, char *val, XrdOucStream *cfg, bool rcf)
Process directive for an integer.
Definition: XrdProofdAux.cxx:1653
XrdProofdDirective
Definition: XrdProofdAux.h:105
XrdProofdDirective::XrdProofdDirective
XrdProofdDirective(const char *n, void *v, XrdFunDirective_t f, bool rcf=1)
Definition: XrdProofdAux.h:113
XrdProofUI::Reset
void Reset()
Definition: XrdProofdAux.h:56
XrdProofdFile
Definition: XrdProofdAux.h:71
XrdProofdPriority::XrdProofdPriority
XrdProofdPriority(const char *usr, int dp)
Definition: XrdProofdAux.h:85
XrdProofdAux::ReadMsg
static int ReadMsg(int fd, XrdOucString &msg)
Receive 'msg' from pipe fd.
Definition: XrdProofdAux.cxx:1516
XrdProofdMultiStrToken::kDigit
@ kDigit
Definition: XrdProofdAux.h:140
DoDirectiveClass
int DoDirectiveClass(XrdProofdDirective *, char *val, XrdOucStream *cfg, bool rcf)
Generic class directive processor.
Definition: XrdProofdAux.cxx:1641
XrdProofdAux::GetLong
static long int GetLong(char *str)
Extract first integer from string at 'str', if any.
Definition: XrdProofdAux.cxx:202
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:168
XrdProofdDSInfo::fLocal
bool fLocal
Definition: XrdProofdAux.h:221
XrdProofdAux::Expand
static char * Expand(char *p)
Expand path 'p' relative to: $HOME if begins with ~/ <user>'s $HOME if begins with ~<user>/ $PWD if d...
Definition: XrdProofdAux.cxx:97
XrdProofdMultiStrToken::fIa
long fIa
Definition: XrdProofdAux.h:131
XrdProofdAux::AssertDir
static int AssertDir(const char *path, XrdProofUI ui, bool changeown)
Make sure that 'path' exists and is owned by the entity described by 'ui'.
Definition: XrdProofdAux.cxx:430
XrdProofdMultiStrToken::XrdProofdMultiStrToken
XrdProofdMultiStrToken(const char *s=0)
Definition: XrdProofdAux.h:142
XrdProofdAux::ParseUsrGrp
static int ParseUsrGrp(const char *path, XrdOucString &usr, XrdOucString &grp)
Parse a path in the form of "<usr>[.<grp>][.<pid>]", filling 'usr' and 'grp'.
Definition: XrdProofdAux.cxx:1614
XrdProofdMultiStrToken::~XrdProofdMultiStrToken
virtual ~XrdProofdMultiStrToken()
Definition: XrdProofdAux.h:143
XrdProofdMultiStr::N
int N() const
Definition: XrdProofdAux.h:166
XrdProofdAux::CheckIf
static int CheckIf(XrdOucStream *s, const char *h)
Check existence and match condition of an 'if' directive If none (valid) is found,...
Definition: XrdProofdAux.cxx:725
XrdProofdPipe::Recv
int Recv(XpdMsg &msg)
Recv message from the pipe.
Definition: XrdProofdAux.cxx:1791
XrdProofdMultiStrToken::fN
int fN
Definition: XrdProofdAux.h:136
XpdSysSemWait.h
XrdProofdPipe::Post
int Post(int type, const char *msg)
Post message on the pipe.
Definition: XrdProofdAux.cxx:1761
XrdProofdAux::GetUserInfo
static int GetUserInfo(const char *usr, XrdProofUI &ui)
Get information about user 'usr' in a thread safe way.
Definition: XrdProofdAux.cxx:293
XProofProtocol.h
XrdProofdPipe::XrdProofdPipe
XrdProofdPipe()
Constructor: create the pipe.
Definition: XrdProofdAux.cxx:1727
XrdProofGI
Definition: XrdProofdAux.h:56
XrdProofUI::fUser
XrdOucString fUser
Definition: XrdProofdAux.h:46
XrdProofdPInfo::pname
XrdOucString pname
Definition: XrdProofdAux.h:94
XrdProofdMultiStrToken::kSimple
@ kSimple
Definition: XrdProofdAux.h:140
v
@ v
Definition: rootcling_impl.cxx:3635
XrdProofdMultiStr::fHead
XrdOucString fHead
Definition: XrdProofdAux.h:153
XrdProofdMultiStrToken::kUndef
@ kUndef
Definition: XrdProofdAux.h:140
XrdProofdAux::RmDir
static int RmDir(const char *path)
Remove directory at path and its content.
Definition: XrdProofdAux.cxx:1346
XrdProofdDSInfo::ToString
XrdOucString ToString() const
Definition: XrdProofdAux.h:229
XrdProofdPInfo::XrdProofdPInfo
XrdProofdPInfo(int i, const char *n)
Definition: XrdProofdAux.h:95
XrdProofdPipe::fRdMtx
XrdSysRecMutex fRdMtx
Definition: XrdProofdAux.h:198
XrdProofdAux::GetProcesses
static int GetProcesses(const char *pn, std::map< int, XrdOucString > *plist)
Get from the process table list of PIDs for processes named "proofserv' For {linux,...
Definition: XrdProofdAux.cxx:921
XrdProofdDirective::fFun
XrdFunDirective_t fFun
Definition: XrdProofdAux.h:109
XpdMsg::Init
int Init(const char *buf)
Init from buffer.
Definition: XrdProofdAux.cxx:1845
XrdProofdMultiStrToken
Definition: XrdProofdAux.h:129
XrdProofUI
Definition: XrdProofdAux.h:38
XrdProofdAux::HasToken
static bool HasToken(const char *s, const char *tokens)
Returns true is 's' contains at least one of the comma-separated tokens in 'tokens'.
Definition: XrdProofdAux.cxx:1135
XrdProofdMultiStr::fTail
XrdOucString fTail
Definition: XrdProofdAux.h:154
XrdProofdPInfo
Definition: XrdProofdAux.h:91
XrdProofGI::~XrdProofGI
~XrdProofGI()
Definition: XrdProofdAux.h:63
XrdProofdAux::ChangeToDir
static int ChangeToDir(const char *dir, XrdProofUI ui, bool changeown)
Change current directory to 'dir'.
Definition: XrdProofdAux.cxx:657
XpdMsg
Definition: XrdProofdAux.h:174
XrdProofdDirective::fRcf
bool fRcf
Definition: XrdProofdAux.h:110
s0
#define s0(x)
Definition: RSha256.hxx:108
XrdProofdDSInfo::fOpts
XrdOucString fOpts
Definition: XrdProofdAux.h:223
XrdProofdDSInfo
Definition: XrdProofdAux.h:217
XrdProofdAux::Write
static int Write(int fd, const void *buf, size_t nb)
Write nb bytes at buf to descriptor 'fd' ignoring interrupts Return the number of bytes written or -1...
Definition: XrdProofdAux.cxx:365
XrdProofdAux::fgFormMutex
static XrdSysRecMutex fgFormMutex
Definition: XrdProofdAux.h:245
XrdProofUI::XrdProofUI
XrdProofUI()
Definition: XrdProofdAux.h:52
XrdProofdMultiStr::Matches
bool Matches(const char *s)
Return true if 's' is compatible with this multi-string.
Definition: XrdProofdAux.cxx:2004
XrdProofdAux::GetGroupInfo
static int GetGroupInfo(const char *grp, XrdProofGI &gi)
Get information about group with 'gid' in a thread safe way.
Definition: XrdProofdAux.cxx:225
h
#define h(i)
Definition: RSha256.hxx:124
XrdProofdMultiStr::fN
int fN
Definition: XrdProofdAux.h:156
XrdProofdMultiStrToken::Matches
bool Matches(const char *s)
Return true if 's' is compatible with this token.
Definition: XrdProofdAux.cxx:2180
XrdProofdAux::SymLink
static int SymLink(const char *path, const char *link)
Create a symlink 'link' to 'path' Return 0 in case of success, -1 in case of error.
Definition: XrdProofdAux.cxx:695
XrdProofdAux::MvDir
static int MvDir(const char *oldpath, const char *newpath)
Move content of directory at oldpath to newpath.
Definition: XrdProofdAux.cxx:1409
XrdProofdPInfo::pid
int pid
Definition: XrdProofdAux.h:93
XrdProofdAux::AdminMsgType
static const char * AdminMsgType(int type)
Translates the admin message type in a human readable string.
Definition: XrdProofdAux.cxx:49
s1
#define s1(x)
Definition: RSha256.hxx:109
DoDirectiveString
int DoDirectiveString(XrdProofdDirective *, char *val, XrdOucStream *cfg, bool rcf)
Process directive for a string.
Definition: XrdProofdAux.cxx:1681
XrdProofdAux::ParsePidPath
static int ParsePidPath(const char *path, XrdOucString &before, XrdOucString &after)
Parse a path in the form of "<before>[.<pid>][.<after>]", filling 'rest' and returning 'pid'.
Definition: XrdProofdAux.cxx:1563
XrdProofdPriority::fDeltaPriority
int fDeltaPriority
Definition: XrdProofdAux.h:84
XrdProofdFile::XrdProofdFile
XrdProofdFile(const char *fn=0, time_t mtime=0)
Definition: XrdProofdAux.h:75
XrdProofdMultiStrToken::IsValid
bool IsValid() const
Definition: XrdProofdAux.h:146
TGeant4Unit::ns
static constexpr double ns
Definition: TGeant4SystemOfUnits.h:167
XpdMsg::Buf
const char * Buf() const
Definition: XrdProofdAux.h:182
XpdMsg::fType
int fType
Definition: XrdProofdAux.h:175
XrdProofdMultiStrToken::kLetter
@ kLetter
Definition: XrdProofdAux.h:140
XrdProofdDirective::fVal
void * fVal
Definition: XrdProofdAux.h:107
XrdProofdDirective::fHost
const char * fHost
Definition: XrdProofdAux.h:111
XrdProofdFile::fMtime
time_t fMtime
Definition: XrdProofdAux.h:74
XrdProofdDirective::fName
XrdOucString fName
Definition: XrdProofdAux.h:108
XrdProofUI::fGroup
XrdOucString fGroup
Definition: XrdProofdAux.h:47
XrdProofdMultiStrToken::Init
void Init(const char *s)
Init the multi-string token.
Definition: XrdProofdAux.cxx:2090
XrdProofdPipe::Close
void Close()
If open, close and invalidated the pipe descriptors.
Definition: XrdProofdAux.cxx:1748
XpdMsg::XpdMsg
XpdMsg(const char *buf=0)
Definition: XrdProofdAux.h:179
XpdMsg::~XpdMsg
virtual ~XpdMsg()
Definition: XrdProofdAux.h:180
XrdProofdDSInfo::fType
XrdOucString fType
Definition: XrdProofdAux.h:219
XrdProofdMultiStrToken::kDigits
@ kDigits
Definition: XrdProofdAux.h:140
XrdProofdMultiStrToken::Export
XrdOucString Export(int &next)
Export 'next' token; use next < 0 start from the first.
Definition: XrdProofdAux.cxx:2215
XrdProofdDSInfo::fUrl
XrdOucString fUrl
Definition: XrdProofdAux.h:220
XrdProofUI::fHomeDir
XrdOucString fHomeDir
Definition: XrdProofdAux.h:48
SetHostInDirectives
int SetHostInDirectives(const char *, XrdProofdDirective *d, void *h)
Set host field for directive 'd' to (const char *h)
Definition: XrdProofdAux.cxx:1707
XrdProofdAux::ChangeOwn
static int ChangeOwn(const char *path, XrdProofUI ui)
Change the ownership of 'path' to the entity described by 'ui'.
Definition: XrdProofdAux.cxx:511
XrdProofdAux::VerifyProcessByID
static int VerifyProcessByID(int pid, const char *pname="proofserv")
Check if a process named 'pname' and process 'pid' is still in the process table.
Definition: XrdProofdAux.cxx:1153
XrdProofGI::fGroup
XrdOucString fGroup
Definition: XrdProofdAux.h:58
XpdMsg::fBuf
XrdOucString fBuf
Definition: XrdProofdAux.h:176
XrdProofdMultiStr::Export
XrdOucString Export()
Return a string with comma-separated elements.
Definition: XrdProofdAux.cxx:2027
XrdProofGI::XrdProofGI
XrdProofGI()
Definition: XrdProofdAux.h:61
XpdMsg::fFrom
int fFrom
Definition: XrdProofdAux.h:177
XrdProofdAux::LogEmsgToFile
static void LogEmsgToFile(const char *flog, const char *emsg, const char *pfx=0)
Logs error message 'emsg' to file 'flog' using standard technology.
Definition: XrdProofdAux.cxx:394
XrdProofdMultiStr::XrdProofdMultiStr
XrdProofdMultiStr(const char *s)
Definition: XrdProofdAux.h:160
XpdMsg::Type
int Type() const
Definition: XrdProofdAux.h:191
XrdProofdMultiStr::Get
XrdOucString Get(int i)
Return i-th combination (i : 0 -> fN-1)
Definition: XrdProofdAux.cxx:2053
XrdProofdAux::KillProcess
static int KillProcess(int pid, bool forcekill, XrdProofUI ui, bool changeown)
Kill the process 'pid'.
Definition: XrdProofdAux.cxx:1293
XrdProofdAux::GetNumCPUs
static int GetNumCPUs()
Find out and return the number of CPUs in the local machine.
Definition: XrdProofdAux.cxx:760
d
#define d(i)
Definition: RSha256.hxx:120
XrdProofdMultiStr
Definition: XrdProofdAux.h:151
XrdProofdMultiStr::IsValid
bool IsValid() const
Definition: XrdProofdAux.h:164
XpdMsg::Reset
void Reset()
Definition: XrdProofdAux.h:185
XrdProofdAux::XrdProofdAux
XrdProofdAux()
Definition: XrdProofdAux.h:247
XrdProofdAux
Definition: XrdProofdAux.h:244
XrdProofGI::fGid
int fGid
Definition: XrdProofdAux.h:59
XrdProofdMultiStrToken::ETokenType
ETokenType
Definition: XrdProofdAux.h:140
XrdProofdAux::AssertBaseDir
static int AssertBaseDir(const char *path, XrdProofUI ui)
Make sure that the base dir of 'path' is either owned by 'ui' or gives full permissions to 'ui'.
Definition: XrdProofdAux.cxx:467
XrdProofdMultiStr::fTokens
std::list< XrdProofdMultiStrToken > fTokens
Definition: XrdProofdAux.h:155
type
int type
Definition: TGX11.cxx:121
XrdProofGI::Reset
void Reset()
Definition: XrdProofdAux.h:65
XrdProofdPriority
Definition: XrdProofdAux.h:81
XrdProofdMultiStrToken::fIb
long fIb
Definition: XrdProofdAux.h:132
XrdProofdPriority::fUser
XrdOucString fUser
Definition: XrdProofdAux.h:83
XrdProofdMultiStrToken::fB
XrdOucString fB
Definition: XrdProofdAux.h:134
XrdProofdMultiStrToken::fA
XrdOucString fA
Definition: XrdProofdAux.h:133
XrdProofdAux::Form
static void Form(XrdOucString &s, const char *fmt, int ns, const char *ss[5], int ni, int ii[6], int np, void *pp[5], int nu=0, unsigned int ui=0)
Recreate the string according to 'fmt', the up to 5 'const char *', up to 6 'int' arguments,...
Definition: XrdProofdAux.cxx:2263
XrdProofUI::fGid
int fGid
Definition: XrdProofdAux.h:50
XrdProofdPipe::~XrdProofdPipe
virtual ~XrdProofdPipe()
Destructor.
Definition: XrdProofdAux.cxx:1739
XrdProofdMultiStr::Init
void Init(const char *s)
Init the multi-string handler.
Definition: XrdProofdAux.cxx:1963
XrdProofdPipe::fWrMtx
XrdSysRecMutex fWrMtx
Definition: XrdProofdAux.h:199
XrdSysRecMutex
#define XrdSysRecMutex
Definition: XrdSysToOuc.h:18
XrdProofUI::~XrdProofUI
~XrdProofUI()
Definition: XrdProofdAux.h:54
XrdProofdAux::ChangeMod
static int ChangeMod(const char *path, unsigned int mode)
Change the permission mode of 'path' to 'mode'.
Definition: XrdProofdAux.cxx:568
int
XrdProofdDirective::DoDirective
int DoDirective(char *val, XrdOucStream *cfg, bool reconfig)
Definition: XrdProofdAux.h:116