Logo ROOT   6.10/09
Reference Guide
XrdROOT.cxx
Go to the documentation of this file.
1 // @(#)root/proofd:$Id$
2 // Author: Gerardo 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 //////////////////////////////////////////////////////////////////////////
13 // //
14 // XrdROOT //
15 // //
16 // Authors: G. Ganis, CERN, 2007 //
17 // //
18 // Class describing a ROOT version //
19 // //
20 //////////////////////////////////////////////////////////////////////////
21 #include "RConfigure.h"
22 
23 #include "XrdProofdPlatform.h"
24 
25 #include "XrdROOT.h"
26 #include "XrdProofdManager.h"
27 #include "XrdProofdProtocol.h"
28 #include "XrdProofdProofServMgr.h"
29 #include "Xrd/XrdScheduler.hh"
30 #include "XrdOuc/XrdOucStream.hh"
31 #include "XrdSys/XrdSysPriv.hh"
32 #include "XpdSysLogger.h"
33 
34 // Tracing
35 #include "XrdProofdTrace.h"
36 
37 ////////////////////////////////////////////////////////////////////////////////
38 /// Constructor: validates 'dir', gets the version and defines the tag.
39 
40 XrdROOT::XrdROOT(const char *dir, const char *tag, const char *bindir,
41  const char *incdir, const char *libdir, const char *datadir)
42 {
43  XPDLOC(SMGR, "XrdROOT")
44 
45  fStatus = -1;
46  fSrvProtVers = -1;
47  fRelease = "";
48  fGitCommit = "";
49  fVersionCode = -1;
50  fVrsMajor = -1;
51  fVrsMinor = -1;
52  fVrsPatch = -1;
53 
54  // 'dir' must make sense
55  if (!dir || strlen(dir) <= 0)
56  return;
57  if (tag && strlen(tag) > 0) {
58  fExport = tag;
59  fExport += " "; fExport += dir;
60  } else
61  fExport += dir;
62  // ... and exist
63  if (CheckDir(dir) != 0) return;
64  fDir = dir;
65 
66  // Include dir
67  fIncDir = incdir;
68  if (!incdir || strlen(incdir) <= 0) {
69  fIncDir = fDir;
70  fIncDir += "/include";
71  }
72  if (CheckDir(fIncDir.c_str()) != 0) return;
73 
74  // Parse version info
75  if (ParseROOTVersionInfo() == -1) {
76  TRACE(XERR, "unable to extract ROOT version information from path "<<fIncDir);
77  return;
78  }
79 
80  // Default tag is the version
81  fTag = (!tag || strlen(tag) <= 0) ? fRelease : tag;
82 
83  // Lib dir
84  fLibDir = libdir;
85  if (!libdir || strlen(libdir) <= 0) {
86  fLibDir = fDir;
87  fLibDir += "/lib";
88  }
89  if (CheckDir(fLibDir.c_str()) != 0) return;
90 
91  // Bin dir
92  fBinDir = bindir;
93  if (!bindir || strlen(bindir) <= 0) {
94  fBinDir = fDir;
95  fBinDir += "/bin";
96  }
97  if (CheckDir(fBinDir.c_str()) != 0) return;
98 
99  // Data dir
100  fDataDir = datadir;
101  if (!datadir || strlen(datadir) <= 0) {
102  fDataDir = fDir;
103  }
104  if (CheckDir(fDataDir.c_str()) != 0) return;
105 
106  // The application to be run
107  fPrgmSrv = fBinDir;
108  fPrgmSrv += "/proofserv";
109 
110  // Export string
111  fExport = fTag;
112  fExport += " "; fExport += fRelease;
113  fExport += " "; fExport += dir;
114 
115  // First step OK
116  fStatus = 0;
117 }
118 
119 ////////////////////////////////////////////////////////////////////////////////
120 /// Check if 'dir' exists
121 /// Return 0 on succes, -1 on failure
122 
123 int XrdROOT::CheckDir(const char *dir)
124 {
125  XPDLOC(SMGR, "CheckDir")
126 
127  if (dir && strlen(dir) > 0) {
128  // The path should exist and be statable
129  struct stat st;
130  if (stat(dir, &st) == -1) {
131  TRACE(XERR, "unable to stat path "<<dir);
132  return -1;
133  }
134  // ... and be a directory
135  if (!S_ISDIR(st.st_mode)) {
136  TRACE(XERR, "path "<<dir<<" is not a directory");
137  return -1;
138  }
139  // Ok
140  return 0;
141  }
142  TRACE(XERR, "path is undefined");
143  return -1;
144 }
145 
146 ////////////////////////////////////////////////////////////////////////////////
147 /// Set valid, save protocol and finalize the export string
148 
149 void XrdROOT::SetValid(kXR_int16 vers)
150 {
151  fStatus = 1;
152 
153  if (vers > 0) {
154  // Cleanup export, if needed
155  if (fSrvProtVers > 0) {
156  XrdOucString vs(" ");
157  vs += fSrvProtVers;
158  fExport.replace(vs,XrdOucString(""));
159  }
160  fSrvProtVers = vers;
161 
162  // Finalize export string
163  fExport += " ";
164  fExport += (int)fSrvProtVers;
165  }
166 }
167 
168 ////////////////////////////////////////////////////////////////////////////////
169 /// Extract ROOT version information associated with 'dir'.
170 
172 {
173  XPDLOC(SMGR, "ParseROOTVersionInfo")
174 
175  int rc = -1;
176 
177  XrdOucString versfile = fIncDir;
178  versfile += "/RVersion.h";
179 
180  // Open file
181  FILE *fv = fopen(versfile.c_str(), "r");
182  if (!fv) {
183  TRACE(XERR, "unable to open "<<versfile);
184  return rc;
185  }
186 
187  // Reset the related variables
188  fRelease = "";
189  fGitCommit = "";
190  fVersionCode = -1;
191  fVrsMajor = -1;
192  fVrsMinor = -1;
193  fVrsPatch = -1;
194 
195  // Read the file
196  char *pv = 0;
197  XrdOucString tkn, sline;
198  char line[1024];
199  while (fgets(line, sizeof(line), fv)) {
200  if (fRelease.length() <= 0 && (pv = (char *) strstr(line, "ROOT_RELEASE"))) {
201  if (line[strlen(line)-1] == '\n')
202  line[strlen(line)-1] = 0;
203  pv += strlen("ROOT_RELEASE") + 1;
204  fRelease = pv;
205  fRelease.replace("\"","");
206  } else if (fGitCommit.length() <= 0 && (pv = (char *) strstr(line, "ROOT_GIT_COMMIT"))) {
207  if (line[strlen(line)-1] == '\n')
208  line[strlen(line)-1] = 0;
209  pv += strlen("ROOT_GIT_COMMIT") + 1;
210  fGitCommit = pv;
211  fGitCommit.replace("\"","");
212  } else if ((pv = (char *) strstr(line, "ROOT_VERSION_CODE"))) {
213  if (line[strlen(line)-1] == '\n') line[strlen(line)-1] = 0;
214  pv += strlen("ROOT_VERSION_CODE");
215  while (pv[0] == ' ') pv++;
216  fVersionCode = atoi(pv);
217  }
218  }
219 
220  // Close the file
221  fclose(fv);
222 
223  // Version code must be there
224  if (fVersionCode < 0) {
225  TRACE(XERR, "incomplete info found in "<<versfile<<": version code missing or bad: "<<fVersionCode);
226  return rc;
227  }
228 
229  // Release tag must be there and in the right format
230  if (fRelease.length() <= 0 ||
232  TRACE(XERR, "incomplete info found in "<<versfile<<": release tag missing or bad: "<<fRelease);
233  return rc;
234  }
235 
236  // Retrieve GIT commit string from dedicated file if the case
237  if (fGitCommit.length() <= 0) {
238 
239  XrdOucString gitcommit = fIncDir;
240  gitcommit += "/RGitCommit.h";
241 
242  // Open file
243  if ((fv = fopen(gitcommit.c_str(), "r"))) {
244 
245  // Read the file
246  pv = 0;
247  while (fgets(line, sizeof(line), fv)) {
248  if (fGitCommit.length() <= 0 && (pv = (char *) strstr(line, "ROOT_GIT_COMMIT"))) {
249  if (line[strlen(line)-1] == '\n')
250  line[strlen(line)-1] = 0;
251  pv += strlen("ROOT_GIT_COMMIT") + 1;
252  fGitCommit = pv;
253  fGitCommit.replace("\"","");
254  if (fGitCommit.length() > 0) break;
255  }
256  }
257 
258  // Close the file
259  fclose(fv);
260 
261  } else {
262  TRACE(REQ, "file "<<gitcommit<<" not found");
263  }
264  }
265 
266  // Done
267  return 0;
268 }
269 
270 ////////////////////////////////////////////////////////////////////////////////
271 /// Translate 'release' into a version code integer following the rules
272 /// in $ROOTSYS/include/RVersion.h.
273 /// 'release' must be in the format 'M.N/PP<something else>', e.g. 5.20/04-cms
274 
275 int XrdROOT::GetVersionCode(const char *release)
276 {
277  int maj, min, patch;
278  if (XrdROOT::ParseReleaseString(release, maj, min, patch) < 0) return -1;
279  return XrdROOT::GetVersionCode(maj, min, patch);
280 }
281 
282 ////////////////////////////////////////////////////////////////////////////////
283 /// Translate 'release' into a version code integer following the rules
284 /// in $ROOTSYS/include/RVersion.h
285 
286 int XrdROOT::GetVersionCode(int maj, int min, int patch)
287 {
288  return ((maj << 16) + (min << 8) + patch);
289 }
290 
291 ////////////////////////////////////////////////////////////////////////////////
292 /// Extract from 'release' its major, minor and patch numerical components;
293 /// 'release' must be in the format 'M.N/PP<something else>', e.g. 5.20/04-cms;
294 /// the part <something else> is ignored.
295 
296 int XrdROOT::ParseReleaseString(const char *release,
297  int &maj, int &min, int &patch)
298 {
299  if (!release || strlen(release) <= 0) return -1;
300 
301  XrdOucString rel(release, 7), tkn;
302  int from = 0;
303  if ((from = rel.tokenize(tkn, from, '.')) == -1) return -1;
304  maj = atoi(tkn.c_str());
305  if ((from = rel.tokenize(tkn, from, '/')) == -1) return -1;
306  min = atoi(tkn.c_str());
307  if ((from = rel.tokenize(tkn, from, ' ')) == -1) return -1;
308  patch = atoi(tkn.c_str());
309 
310  return 0;
311 }
312 
313 //
314 // Manager
315 
316 ////////////////////////////////////////////////////////////////////////////////
317 /// Constructor
318 
320  XrdProtocol_Config *pi, XrdSysError *e)
321  : XrdProofdConfig(pi->ConfigFN, e)
322 {
323  fMgr = mgr;
324  fLogger = pi->eDest->logger();
325  fROOT.clear();
326 
327  // Configuration directives
329 }
330 
331 ////////////////////////////////////////////////////////////////////////////////
332 /// Set the log dir
333 
334 void XrdROOTMgr::SetLogDir(const char *dir)
335 {
336  XPDLOC(SMGR, "ROOTMgr::SetLogDir")
337 
338  if (fMgr && dir && strlen(dir)) {
339  // MAke sure that the directory to store logs from validation exists
340  XPDFORM(fLogDir, "%s/rootsysvalidation", dir);
341  XrdProofUI ui;
343  if (XrdProofdAux::AssertDir(fLogDir.c_str(), ui, fMgr->ChangeOwn()) != 0) {
344  XPDERR("unable to assert the rootsys log validation path: "<<fLogDir);
345  fLogDir = "";
346  } else {
347  TRACE(ALL,"rootsys log validation path: "<<fLogDir);
348  }
349  }
350 }
351 
352 ////////////////////////////////////////////////////////////////////////////////
353 /// Run configuration and parse the entered config directives.
354 /// Return 0 on success, -1 on error
355 
356 int XrdROOTMgr::Config(bool rcf)
357 {
358  XPDLOC(SMGR, "ROOTMgr::Config")
359 
360  // Run first the configurator
361  if (XrdProofdConfig::Config(rcf) != 0) {
362  TRACE(XERR, "problems parsing file ");
363  return -1;
364  }
365 
366  XrdOucString msg;
367  msg = (rcf) ? "re-configuring" : "configuring";
368  TRACE(ALL, msg);
369 
370  // ROOT dirs
371  if (rcf) {
372  // Remove parked ROOT sys entries
373  std::list<XrdROOT *>::iterator tri;
374  if (fROOT.size() > 0) {
375  for (tri = fROOT.begin(); tri != fROOT.end();) {
376  if ((*tri)->IsParked()) {
377  delete (*tri);
378  tri = fROOT.erase(tri);
379  } else {
380  tri++;
381  }
382  }
383  }
384  } else {
385  // Check the ROOT dirs
386  if (fROOT.size() <= 0) {
387  XrdOucString dir, bd, ld, id, dd;
388 #ifdef R__HAVE_CONFIG
389  if (getenv("ROOTIGNOREPREFIX"))
390 #endif
391  dir = getenv("ROOTSYS");
392 #ifdef R__HAVE_CONFIG
393  else {
394  dir = ROOTPREFIX;
395  bd = ROOTBINDIR;
396  ld = ROOTLIBDIR;
397  id = ROOTINCDIR;
398  dd = ROOTDATADIR;
399  }
400 #endif
401  // None defined: use ROOTSYS as default, if any; otherwise we fail
402  if (dir.length() > 0) {
403  XrdROOT *rootc = new XrdROOT(dir.c_str(), "",
404  bd.c_str(), id.c_str(), ld.c_str(), dd.c_str());
405  if (Validate(rootc, fMgr->Sched()) == 0) {
406  XPDFORM(msg, "ROOT dist: '%s' validated", rootc->Export());
407  fROOT.push_back(rootc);
408  TRACE(ALL, msg);
409  XrdOucString mnp;
410  XPDFORM(mnp, "ROOT version details: git: '%s', code: %d, {mnp} = {%d,%d,%d}",
411  rootc->GitCommit(), rootc->VersionCode(), rootc->VrsMajor(),
412  rootc->VrsMinor(), rootc->VrsPatch());
413  TRACE(ALL, mnp);
414  } else {
415  XPDFORM(msg, "ROOT dist: '%s' could not be validated", rootc->Export());
416  TRACE(XERR, msg);
417  }
418  }
419  if (fROOT.size() <= 0) {
420  TRACE(XERR, "no ROOT dir defined; ROOTSYS location missing - unloading");
421  return -1;
422  }
423  }
424  }
425 
426  // Done
427  return 0;
428 }
429 
430 ////////////////////////////////////////////////////////////////////////////////
431 /// Register directives for configuration
432 
434 {
435  Register("rootsys", new XrdProofdDirective("rootsys", this, &DoDirectiveClass));
436 }
437 
438 ////////////////////////////////////////////////////////////////////////////////
439 /// Update the priorities of the active sessions.
440 
442  char *val, XrdOucStream *cfg, bool rcf)
443 {
444  XPDLOC(SMGR, "ROOTMgr::DoDirective")
445 
446  if (!d)
447  // undefined inputs
448  return -1;
449 
450  if (d->fName == "rootsys") {
451  return DoDirectiveRootSys(val, cfg, rcf);
452  }
453  TRACE(XERR, "unknown directive: "<<d->fName);
454  return -1;
455 }
456 
457 ////////////////////////////////////////////////////////////////////////////////
458 /// Process 'rootsys' directive
459 
460 int XrdROOTMgr::DoDirectiveRootSys(char *val, XrdOucStream *cfg, bool)
461 {
462  XPDLOC(SMGR, "ROOTMgr::DoDirectiveRootSys")
463 
464  if (!val || !cfg)
465  // undefined inputs
466  return -1;
467 
468  // Two tokens may be meaningful
469  XrdOucString dir = val;
470  val = cfg->GetWord();
471  XrdOucString tag = val;
472  bool ok = 1;
473  if (tag == "if") {
474  tag = "";
475  // Conditional
476  cfg->RetToken();
477  ok = (XrdProofdAux::CheckIf(cfg, fMgr->Host()) > 0) ? 1 : 0;
478  }
479  if (ok) {
480  // Check for additional info in the form: bindir incdir libdir datadir
481  XrdOucString a[4];
482  int i = 0;
483  if (tag.length() > 0) {
484  while ((val = cfg->GetWord())) { a[i++] = val; }
485  }
486  XrdROOT *rootc = new XrdROOT(dir.c_str(), tag.c_str(), a[0].c_str(),
487  a[1].c_str(), a[2].c_str(), a[3].c_str());
488  // Check if already validated
489  std::list<XrdROOT *>::iterator ori;
490  for (ori = fROOT.begin(); ori != fROOT.end(); ori++) {
491  if ((*ori)->Match(rootc->Dir(), rootc->Tag())) {
492  if ((*ori)->IsParked()) {
493  (*ori)->SetValid();
494  SafeDel(rootc);
495  break;
496  }
497  }
498  }
499  // If not, try validation
500  if (rootc) {
501  if (Validate(rootc, fMgr->Sched()) == 0) {
502  TRACE(REQ, "validation OK for: "<<rootc->Export());
503  XrdOucString mnp;
504  XPDFORM(mnp, "version details: git: '%s', code: %d, {mnp} = {%d,%d,%d}",
505  rootc->GitCommit(), rootc->VersionCode(), rootc->VrsMajor(),
506  rootc->VrsMinor(), rootc->VrsPatch());
507  TRACE(REQ, mnp);
508  // Add to the list
509  fROOT.push_back(rootc);
510  } else {
511  TRACE(XERR, "could not validate "<<rootc->Export());
512  SafeDel(rootc);
513  }
514  }
515  }
516  return 0;
517 }
518 
519 ////////////////////////////////////////////////////////////////////////////////
520 /// Start a trial server application to test forking and get the version
521 /// of the protocol run by the PROOF server.
522 /// Return 0 if everything goes well, -1 in case of any error.
523 
524 int XrdROOTMgr::Validate(XrdROOT *r, XrdScheduler *sched)
525 {
526  XPDLOC(SMGR, "ROOTMgr::Validate")
527 
528  TRACE(REQ, "forking test and protocol retrieval");
529 
530  if (r->IsInvalid()) {
531  // Cannot be validated
532  TRACE(XERR, "invalid instance - cannot be validated");
533  return -1;
534  }
535 
536  // Make sure the application path has been defined
537  if (!r->PrgmSrv() || strlen(r->PrgmSrv()) <= 0) {
538  TRACE(XERR, "path to PROOF server application undefined - exit");
539  return -1;
540  }
541 
542  // Make sure the scheduler is defined
543  if (!sched) {
544  TRACE(XERR, "scheduler undefined - exit");
545  return -1;
546  }
547 
548  // Pipe to communicate the protocol number
549  int fp[2];
550  if (pipe(fp) != 0) {
551  TRACE(XERR, "PROOT protocol number communication");
552  return -1;
553  }
554 
555  // Debug flag
556  bool debug = 0;
557  if (TRACING(DBG)) debug = 1;
558 
559  // Log the attemp into this file
560  XrdOucString logfile, rootrc;
561  if (fLogDir.length() > 0) {
562  XrdOucString tag(r->Tag());
563  tag.replace("/","-");
564  XPDFORM(logfile, "%s/root.%s.log", fLogDir.c_str(), tag.c_str());
565  if (debug) {
566  XPDFORM(rootrc, "%s/root.%s.rootrc", fLogDir.c_str(), tag.c_str());
567  }
568  }
569 
570  // Fork a test agent process to handle this session
571  TRACE(FORK,"XrdROOTMgr::Validate: forking external proofsrv");
572  int pid = -1;
573  if (!(pid = sched->Fork("proofsrv"))) {
574 
575  if (logfile.length() > 0 && fLogger) {
576  // Log to the session log file from now on
577  fLogger->Bind(logfile.c_str());
578  // Transfer the info to proofserv
579  size_t len = strlen("ROOTPROOFLOGFILE=") + logfile.length() + 2;
580  char *ev = new char[len];
581  snprintf(ev, len, "ROOTPROOFLOGFILE=%s", logfile.c_str());
582  putenv(ev);
583  if (debug && rootrc.length() > 0) {
584  // Create .rootrc
585  FILE *frc = fopen(rootrc.c_str(),"w");
586  if (frc) {
587  fprintf(frc, "Proof.DebugLevel: 1\n");
588  fclose(frc);
589  }
590  // Transfer the info to proofserv
591  len = strlen("ROOTRCFILE=") + rootrc.length() + 2;
592  ev = new char[len];
593  snprintf(ev, len, "ROOTRCFILE=%s", rootrc.c_str());
594  putenv(ev);
595  }
596  }
597 
598  char *argvv[6] = {0};
599 
600  // start server
601  argvv[0] = (char *)r->PrgmSrv();
602  argvv[1] = (char *)"proofserv";
603  argvv[2] = (char *)"xpd";
604  argvv[3] = (char *)"test";
605  if (debug) {
606  argvv[4] = (char *)"1";
607  argvv[5] = 0;
608  } else {
609  argvv[4] = 0;
610  argvv[5] = 0;
611  }
612 
613  // Set basic environment for proofserv
615  TRACE(XERR, " SetProofServEnv did not return OK - EXIT");
616  exit(1);
617  }
618 
619  // Set Open socket
620  char *ev = new char[25];
621  snprintf(ev, 25, "ROOTOPENSOCK=%d", fp[1]);
622  putenv(ev);
623 
624  // Prepare for execution: we need to acquire the identity of
625  // a normal user
626  if (!getuid()) {
627  XrdProofUI ui;
628  if (XrdProofdAux::GetUserInfo(geteuid(), ui) != 0) {
629  TRACE(XERR, "could not get info for user-id: "<<geteuid());
630  exit(1);
631  }
632 
633  // acquire permanently target user privileges
634  if (XrdSysPriv::ChangePerm((uid_t)ui.fUid, (gid_t)ui.fGid) != 0) {
635  TRACE(XERR, "can't acquire "<<ui.fUser <<" identity");
636  exit(1);
637  }
638 
639  }
640 
641  // Run the program
642  execv(r->PrgmSrv(), argvv);
643 
644  // We should not be here!!!
645  TRACE(XERR, "returned from execv: bad, bad sign !!!");
646  exit(1);
647  }
648 
649  // parent process
650  if (pid < 0) {
651  TRACE(XERR, "forking failed - exit");
652  close(fp[0]);
653  close(fp[1]);
654  return -1;
655  }
656 
657  // now we wait for the callback to be (successfully) established
658  TRACE(FORK, "test server launched: wait for protocol ");
659 
660  // Read protocol
661  int proto = -1;
662  struct pollfd fds_r;
663  fds_r.fd = fp[0];
664  fds_r.events = POLLIN;
665  int pollRet = 0;
666  // We wait for 60 secs max (30 x 2000 millisecs): this is enough to
667  // cover possible delays due to heavy load
668  int ntry = 30;
669  while (pollRet == 0 && ntry--) {
670  while ((pollRet = poll(&fds_r, 1, 2000)) < 0 &&
671  (errno == EINTR)) { }
672  if (pollRet == 0)
673  TRACE(DBG, "receiving PROOF server protocol number: waiting 2 s ...");
674  }
675  if (pollRet > 0) {
676  if (read(fp[0], &proto, sizeof(proto)) != sizeof(proto)) {
677  TRACE(XERR, "problems receiving PROOF server protocol number");
678  return -1;
679  }
680  } else {
681  if (pollRet == 0) {
682  TRACE(XERR, "timed-out receiving PROOF server protocol number");
683  } else {
684  TRACE(XERR, "failed to receive PROOF server protocol number");
685  }
686  return -1;
687  }
688 
689  // Set valid, record protocol and update export string
690  r->SetValid((kXR_int16) ntohl(proto));
691 
692  // Cleanup files
693  if (logfile.length() > 0 && !debug) {
694  if (unlink(logfile.c_str()) != 0) {
695  TRACE(XERR, "problems unlinking "<<logfile<<"; errno: "<<errno);
696  }
697  }
698  if (debug && rootrc.length() > 0 && unlink(rootrc.c_str()) != 0) {
699  TRACE(XERR, "problems unlinking "<<rootrc<<"; errno: "<<errno);
700  }
701 
702  // Cleanup
703  close(fp[0]);
704  close(fp[1]);
705 
706  // We are done
707  return 0;
708 }
709 
710 ////////////////////////////////////////////////////////////////////////////////
711 /// Return a string describing the available versions, with the default
712 /// version 'def' markde with a '*'
713 
715 {
716  XrdOucString out;
717 
718  // Generic info about all known sessions
719  std::list<XrdROOT *>::iterator ip;
720  for (ip = fROOT.begin(); ip != fROOT.end(); ++ip) {
721  // Flag the default one
722  if (def == *ip)
723  out += " * ";
724  else
725  out += " ";
726  out += (*ip)->Export();
727  out += "\n";
728  }
729 
730  // Over
731  return out;
732 }
733 
734 ////////////////////////////////////////////////////////////////////////////////
735 /// Return pointer to the ROOT version corresponding to 'tag'
736 /// or 0 if not found.
737 
739 {
740  XrdROOT *r = 0;
741 
742  std::list<XrdROOT *>::iterator ip;
743  for (ip = fROOT.begin(); ip != fROOT.end(); ++ip) {
744  if ((*ip)->MatchTag(tag)) {
745  r = (*ip);
746  break;
747  }
748  }
749 
750  // Over
751  return r;
752 }
XrdROOT(const char *dir, const char *tag, const char *bindir=0, const char *incdir=0, const char *libdir=0, const char *datadir=0)
Constructor: validates &#39;dir&#39;, gets the version and defines the tag.
Definition: XrdROOT.cxx:40
double read(const std::string &file_name)
reading
#define SafeDel(x)
Definition: XrdProofdAux.h:335
void SetLogDir(const char *d)
Set the log dir.
Definition: XrdROOT.cxx:334
XrdOucString fRelease
Definition: XrdROOT.h:49
#define TRACING(x)
TLine * line
const double pi
static int GetUserInfo(const char *usr, XrdProofUI &ui)
Get information about user &#39;usr&#39; in a thread safe way.
XrdROOTMgr(XrdProofdManager *mgr, XrdProtocol_Config *pi, XrdSysError *e)
Constructor.
Definition: XrdROOT.cxx:319
XrdOucString fBinDir
Definition: XrdROOT.h:40
int SetProofServEnv(XrdProofdProtocol *p, void *in)
Set environment for proofserv.
int DoDirectiveClass(XrdProofdDirective *, char *val, XrdOucStream *cfg, bool rcf)
Generic class directive processor.
XrdOucString fGitCommit
Definition: XrdROOT.h:50
#define TRACE(Flag, Args)
Definition: TGHtml.h:120
int fVersionCode
Definition: XrdROOT.h:51
XrdScheduler * Sched() const
TArc * a
Definition: textangle.C:12
int DoDirective(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Update the priorities of the active sessions.
Definition: XrdROOT.cxx:441
bool ChangeOwn() const
static int ChangePerm(uid_t uid, gid_t gid)
XrdOucString fDir
Definition: XrdROOT.h:39
static int GetVersionCode(const char *release)
Translate &#39;release&#39; into a version code integer following the rules in $ROOTSYS/include/RVersion.h.
Definition: XrdROOT.cxx:275
int fVrsMajor
Definition: XrdROOT.h:53
int Validate(XrdROOT *r, XrdScheduler *sched)
Start a trial server application to test forking and get the version of the protocol run by the PROOF...
Definition: XrdROOT.cxx:524
void SetValid(kXR_int16 vers=-1)
Set valid, save protocol and finalize the export string.
Definition: XrdROOT.cxx:149
int DoDirectiveRootSys(char *, XrdOucStream *, bool)
Process &#39;rootsys&#39; directive.
Definition: XrdROOT.cxx:460
void RegisterDirectives()
Register directives for configuration.
Definition: XrdROOT.cxx:433
bool IsInvalid() const
Definition: XrdROOT.h:74
int VrsPatch() const
Definition: XrdROOT.h:87
XrdOucString fLogDir
Definition: XrdROOT.h:101
XrdOucString fExport
Definition: XrdROOT.h:45
XrdSysLogger * fLogger
Definition: XrdROOT.h:100
std::list< XrdROOT * > fROOT
Definition: XrdROOT.h:103
XrdOucString fTag
Definition: XrdROOT.h:44
XrdOucString fUser
Definition: XrdProofdAux.h:40
#define XPDLOC(d, x)
int VrsMajor() const
Definition: XrdROOT.h:85
XrdOucString fDataDir
Definition: XrdROOT.h:41
#define XPDERR(x)
int fVrsMinor
Definition: XrdROOT.h:54
TRandom2 r(17)
XrdROOT * GetVersion(const char *tag)
Return pointer to the ROOT version corresponding to &#39;tag&#39; or 0 if not found.
Definition: XrdROOT.cxx:738
XrdOucString ExportVersions(XrdROOT *def)
Return a string describing the available versions, with the default version &#39;def&#39; markde with a &#39;*&#39;...
Definition: XrdROOT.cxx:714
const char * Host() const
#define XrdSysError
Definition: XpdSysError.h:8
int VrsMinor() const
Definition: XrdROOT.h:86
const char * Tag() const
Definition: XrdROOT.h:83
const char * GitCommit() const
Definition: XrdROOT.h:71
XrdOucString fLibDir
Definition: XrdROOT.h:43
int fStatus
Definition: XrdROOT.h:38
static int AssertDir(const char *path, XrdProofUI ui, bool changeown)
Make sure that &#39;path&#39; exists and is owned by the entity described by &#39;ui&#39;.
#define XPDFORM
Definition: XrdProofdAux.h:381
int ParseROOTVersionInfo()
Extract ROOT version information associated with &#39;dir&#39;.
Definition: XrdROOT.cxx:171
static int CheckIf(XrdOucStream *s, const char *h)
Check existence and match condition of an &#39;if&#39; directive If none (valid) is found, return -1.
kXR_int16 fSrvProtVers
Definition: XrdROOT.h:47
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
Definition: XrdROOT.cxx:356
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
XrdOucString fPrgmSrv
Definition: XrdROOT.h:46
const char * EffectiveUser() const
const char * Export() const
Definition: XrdROOT.h:70
static int ParseReleaseString(const char *release, int &maj, int &min, int &patch)
Extract from &#39;release&#39; its major, minor and patch numerical components; &#39;release&#39; must be in the form...
Definition: XrdROOT.cxx:296
XrdProofdManager * fMgr
Definition: XrdROOT.h:99
int CheckDir(const char *dir)
Check if &#39;dir&#39; exists Return 0 on succes, -1 on failure.
Definition: XrdROOT.cxx:123
XrdOucString fName
Definition: XrdProofdAux.h:111
XrdOucString fIncDir
Definition: XrdROOT.h:42
#define snprintf
Definition: civetweb.c:822
const char * proto
Definition: civetweb.c:11652
bool debug
int fVrsPatch
Definition: XrdROOT.h:55
virtual int Config(bool rcf=0)
const char * Dir() const
Definition: XrdROOT.h:65
void Register(const char *dname, XrdProofdDirective *d)
const char * PrgmSrv() const
Definition: XrdROOT.h:79
int VersionCode() const
Definition: XrdROOT.h:84