23#include "XrdOuc/XrdOucStream.hh"
41#define XPD_MAXLEN 1024
51 static const char *
msgtypes[] = {
"Undef",
52 "QuerySessions",
"SessionTag",
"SessionAlias",
"GetWorkers",
"QueryWorkers",
53 "CleanupSessions",
"QueryLogPaths",
"ReadBuffer",
"QueryROOTVersions",
54 "ROOTVersion",
"GroupProperties",
"SendMsgToUser",
"ReleaseWorker",
55 "Exec",
"GetFile",
"PutFile",
"CpFile",
"QueryMssUrl"};
72 static const char *
reqtypes[] = {
"Undef",
73 "XP_login",
"XP_auth",
"XP_create",
"XP_destroy",
"XP_attach",
"XP_detach",
74 "XP_3107",
"XP_3108",
"XP_3109",
"XP_3110",
75 "XP_urgent",
"XP_sendmsg",
"XP_admin",
"XP_interrupt",
"XP_ping",
76 "XP_cleanup",
"XP_readbuf",
"XP_touch",
"XP_ctrlc",
"XR_direct" };
108 XrdOucString env(&
p[1]);
109 int isl = env.find(
'/');
111 char *
p1 = (
isl > 0) ? (
char *)(
p +
isl + 2) : 0;
112 if (
getenv(env.c_str())) {
162 int ldir =
ui.fHomeDir.length();
213 while (*(
p+
j) >= 48 && *(
p+
j) <= 57)
235#if defined(__sun) && !defined(__GNUC__)
250 return ((
int) -
errno);
269#if defined(__sun) && !defined(__GNUC__)
276 gi.fGroup =
gr.gr_name;
284 return ((
int) -
errno);
303#if defined(__sun) && !defined(__GNUC__)
312 ui.fHomeDir =
pw.pw_dir;
320 return ((
int) -
errno);
339#if defined(__sun) && !defined(__GNUC__)
348 ui.fHomeDir =
pw.pw_dir;
349 ui.fUser =
pw.pw_name;
356 return ((
int) -
errno);
370 const char *
pw = (
const char *)buf;
412 if (close(
logfd) != 0)
436 if (!path ||
strlen(path) <= 0)
440 TRACE(
XERR,
"could not get privileges to change ownership");
445 TRACE(
XERR,
"unable to create dir: "<<path<<
" (errno: "<<
errno<<
")");
451 if (
chown(path,
ui.fUid,
ui.fGid) == -1) {
452 TRACE(
XERR,
"cannot set user ownership on path (errno: "<<
errno<<
")");
473 if (!path ||
strlen(path) <= 0)
476 XrdOucString base(path);
477 if (base.endswith(
"/")) base.erasefromend(1);
478 int isl = base.rfind(
'/');
479 if (
isl != 0) base.erase(
isl);
483 if (stat(base.c_str(), &
st) != 0) {
485 TRACE(
XERR,
"unable to stat base path: "<<base<<
" (errno: "<<
errno<<
")");
490 if (
ui.fUid != (
int)
st.st_uid) {
492 if (
ui.fGid != (
int)
st.st_gid)
497 TRACE(
XERR,
"effective user has not full permissions on base path: "<<base);
517 if (!path ||
strlen(path) <= 0)
522 XrdOucString
proot(path);
527 if (ent->d_name[0] ==
'.' || !
strcmp(ent->d_name,
".."))
continue;
533 TRACE(
XERR,
"problems changing recursively ownership of: "<<
fn);
550 TRACE(
XERR,
"could not get privileges to change ownership");
554 if (
chown(path,
ui.fUid,
ui.fGid) == -1) {
555 TRACE(
XERR,
"cannot set user ownership on path (errno: "<<
errno<<
")");
574 if (!path ||
strlen(path) <= 0)
578 if (stat(path,&
st) != 0) {
580 TRACE(
XERR,
"unable to stat path: "<<path<<
" (errno: "<<
errno<<
")");
588 TRACE(
XERR,
"could not get privileges to change ownership");
592 if (chmod(path,
mode) == -1) {
593 TRACE(
XERR,
"cannot change permissions on path (errno: "<<
errno<<
")");
606 XrdOucString
proot(path);
611 if (ent->d_name[0] ==
'.' || !
strcmp(ent->d_name,
".."))
continue;
616 if (stat(
fn.c_str(),&
xst) == 0) {
621 TRACE(
XERR,
"could not get privileges to change ownership");
626 if (chmod(
fn.c_str(),
mode) == -1) {
627 TRACE(
XERR,
"cannot change permissions on path (errno: "<<
errno<<
")");
635 TRACE(
XERR,
"problems changing recursively permissions of: "<<
fn);
707 " (errno: "<<
errno<<
")");
712 " (errno: "<<
errno<<
")");
730 char *val = s ? s->GetWord() : 0;
731 if (!val ||
strncmp(val,
"if",2)) {
744 TRACE(
ALL,
">>> Warning: 'if' conditions at the end of the directive are deprecated ");
745 TRACE(
ALL,
">>> Please use standard Scalla/Xrootd 'if-else-fi' constructs");
746 TRACE(
ALL,
">>> (see http://xrootd.slac.stanford.edu/doc/xrd_config/xrd_config.htm)");
749 TRACE(
DBG,
"Aux::CheckIf: <pattern>: " <<val);
752 XrdOucString
h(host);
753 return h.matches((
const char *)val);
764 static int ncpu = -1;
775 XrdOucString
fcpu(
"/proc/cpuinfo");
779 TRACE(
XERR,
"/proc/cpuinfo missing!!! Something very bad going on");
787 char line[2048] = { 0 };
800 char line[2048] = { 0 };
806#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
809 FILE *fp =
popen(
"sysctl -n hw.ncpu",
"r");
811 char line[2048] = { 0 };
824#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
871 0, &
len, 0, 0)) == -1) {
887 res, &
len, 0, 0)) == -1) {
899 }
while (
rc == 0 && !
done);
902 if (
rc != 0 && !res) {
936#if defined(linux) || defined(__sun)
940 emsg =
"cannot open /proc - errno: ";
948 if (
DIGIT(ent->d_name[0])) {
949 XrdOucString
fn(
"/proc/", 256);
956 emsg =
"cannot open file ";
964 char line[2048] = { 0 };
978 fn.replace(
"/status",
"/cmdline");
981 emsg =
"cannot open file ";
990 int pos = 0,
ltot = 0,
nr = 1;
1002 }
else if (
nr > 0) {
1003 if (*
p == 0) *
p =
' ';
1011 pid =
strtol(ent->d_name, 0, 10);
1012 pmap->insert(std::make_pair(pid, cmd));
1022 emsg =
"cannot open file ";
1030 emsg =
"cannot read ";
1039 XrdOucString cmd(
psi.pr_fname);
1040 if (cmd.length() > 0) cmd +=
" ";
1041 cmd +=
psi.pr_psargs;
1043 int pid =
strtol(ent->d_name, 0, 10);
1044 pmap->insert(std::make_pair(pid, cmd));
1055#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
1060 if ((
ern = XrdProofdAux::GetMacProcList(&
pl,
np)) != 0) {
1061 emsg =
"cannot get the process list: errno: ";
1083 XrdOucString cmd =
"ps ax -ww | grep proofserv 2>/dev/null";
1086 XrdOucString
pids =
":";
1089 char line[2048] = { 0 };
1092 pmap->insert(std::make_pair(pid, XrdOucString(
line)));
1124 XPDFORM(
emsg,
"GetIDFromPath: error reading id from: %s (errno: %d)",
1137 if (s &&
strlen(s) > 0) {
1170 const char *
pn = (pname &&
strlen(pname) > 0) ? pname :
"proofserv";
1174 XrdOucString
fn(
"/proc/");
1180 TRACE(
DBG,
"process does not exists anymore");
1189 char line[2048] = { 0 };
1206 XrdOucString
fn(
"/proc/");
1212 TRACE(
DBG,
"VerifyProcessByID: process does not exists anymore");
1238#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
1244 if ((
ern = XrdProofdAux::GetMacProcList(&
pl,
np)) != 0) {
1263 XrdOucString cmd =
"ps ax | grep proofserv 2>/dev/null";
1264 if (pname &&
strlen(pname))
1265 cmd.replace(
"proofserv", pname);
1268 char line[2048] = { 0 };
1304 TRACE(
XERR,
"could not get privileges");
1312 XPDFORM(
msg,
"kill(pid,SIGKILL) failed for process %d; errno: %d", pid,
errno);
1322 XPDFORM(
msg,
"kill(pid,SIGTERM) failed for process %d; errno: %d", pid,
errno);
1331 TRACE(
DBG,
"process ID "<<pid<<
" not found in the process table");
1367 if (!
strcmp(ent->d_name,
".") || !
strcmp(ent->d_name,
".."))
continue;
1370 if (stat(
entry.c_str(), &
st) != 0) {
1395 if (!
rc && rmdir(path) != 0) {
1397 TRACE(
XERR,
"problems removing"<<path<<
" ; error: "<<-
rc);
1428 " does not exist or is not a directory; errno: "<<
errno);
1438 if (!
strcmp(ent->d_name,
".") || !
strcmp(ent->d_name,
".."))
continue;
1489 if (
utime(path, 0) != 0)
1491 }
else if (opt <= 2) {
1493 if (stat(path, &
st) != 0)
1497 ut.actime = time(0);
1498 ut.modtime =
st.st_mtime;
1499 }
else if (opt == 2) {
1500 ut.modtime = time(0);
1501 ut.actime =
st.st_atime;
1525 if (read(fd, &
len,
sizeof(
len)) !=
sizeof(
len))
1534 while ((
nr = read(fd, buf,
wanted)) < 0 &&
1545 }
while (
nr > 0 &&
len > 0);
1553 TRACE(
XERR,
"pipe descriptor undefined: "<<fd);
1571 if (path &&
strlen(path)) {
1574 XrdOucString
spid, s(path);
1577 if (
spid.length() > 0) {
1578 if (
spid.isdigit()) {
1586 if (
nopid && pid > 0) {
1597 if (pid == 0 &&
before.length() == 0) {
1603 TRACE(
HDBG,
"path: "<<(path ? path :
"<nul>")<<
" --> before: '"<<
before
1604 <<
"', pid: "<<pid<<
", after: '"<<
after<<
"'");
1616 XrdOucString rest,
after;
1619 if (pid >= 0 && rest.length() > 0) {
1627 grp.erase(0,
ip + 1);
1643 if (!
d || !(
d->fVal))
1657 if (!
d || !(
d->fVal) || !val)
1661 if (
rcf && !
d->fRcf)
1666 if (
d->fHost && cfg)
1670 long int v =
strtol(val,0,10);
1671 *((
int *)
d->fVal) =
v;
1673 TRACE(
DBG,
"set "<<
d->fName<<
" to "<<*((
int *)
d->fVal));
1685 if (!
d || !(
d->fVal) || !val)
1689 if (
rcf && !
d->fRcf)
1694 if (
d->fHost && cfg)
1698 *((XrdOucString *)
d->fVal) = val;
1700 TRACE(
DBG,
"set "<<
d->fName<<
" to "<<*((XrdOucString *)
d->fVal));
1709 const char *host = (
const char *)
h;
1711 if (!
d || !host ||
strlen(host) <= 0)
1774 int len = buf.length() + 1;
1802 msg.Init(buf.c_str());
1827 int xto = (
to > 0) ?
to * 1000 : -1;
1853 TRACE(
HDBG,
"buf: "<< (
const char *)(buf ? buf :
"+++ empty +++"));
1855 if (buf &&
strlen(buf) > 0) {
1874 while (
fBuf.beginswith(
' '))
1915 if ((
fFrom =
fBuf.tokenize(s,
fFrom,
' ')) == -1 || s.length() <= 0) {
1975 if (
ie ==
ib + 1)
return;
1985 if (
tkn.length() > 0) {
2007 XrdOucString str(s);
2008 if (
fHead.length() <= 0 || str.beginswith(
fHead)) {
2009 if (
fTail.length() <= 0 || str.endswith(
fTail)) {
2010 str.replace(
fHead,
"");
2011 str.replace(
fTail,
"");
2012 std::list<XrdProofdMultiStrToken>::iterator it =
fTokens.begin();
2013 for (; it !=
fTokens.end(); ++it) {
2014 if ((*it).Matches(str.c_str()))
2029 XrdOucString str(
fN * (
fHead.length() +
fTail.length() + 4)) ;
2032 std::list<XrdProofdMultiStrToken>::iterator it =
fTokens.begin();
2033 for (; it !=
fTokens.end(); ++it) {
2034 int n = (*it).N(),
j = -1;
2037 str += (*it).Export(
j);
2044 if (str.endswith(
','))
2045 str.erase(str.rfind(
','));
2058 std::list<XrdProofdMultiStrToken>::iterator it =
fTokens.begin();
2059 for (; it !=
fTokens.end(); ++it) {
2060 int n = (*it).N(),
j = -1;
2066 str += (*it).Export(
j);
2103 int id =
fA.find(
'-');
2111 fB.assign(
fA,
id + 1);
2113 if (
fB.length() <= 0) {
2114 if (
fA.length() > 0) {
2123 char *
a = (
char *)
fA.c_str();
2124 char *
b = (
char *)
fB.c_str();
2125 if (
fA.length() == 1 &&
fB.length() == 1) {
2143 emsg =
"not-supported single-field extremes";
2156 emsg =
"non-digit or wrong-ordered extremes";
2160 emsg =
"non-digit extremes";
2184 return ((
fA == s) ? 1 : 0);
2186 XrdOucString str(s);
2189 if (str.length() > 1)
2191 char *ps = (
char *)s;
2217 XrdOucString
tkn(
fA.length());
2241 tkn = (char)(
fIa + next);
2247 XrdOucString tmp(
fA.length());
2248 tmp.form(
"%ld",
fIa + next);
2250 int dl =
fA.length() - tmp.length();
2251 if (
dl <= 0)
return tmp;
2254 while (
dl--)
tkn +=
"0";
2264 int ns,
const char *
ss[5],
2266 int np,
void *pp[5],
2267 int nu,
unsigned int ui)
2272 char si[32],
sp[32];
2278 while (i-- > 0) {
len += 32; }
2288 if (s[k+1] ==
's') {
2290 s.replace(
"%s",
ss[
nss++], k, k + 1);
2293 }
else if (s[k+1] ==
'd') {
2296 s.replace(
"%d",
si, k, k + 1);
2299 }
else if (s[k+1] ==
'u') {
2302 s.replace(
"%u",
si, k, k + 1);
2305 }
else if (s[k+1] ==
'p') {
2308 s.replace(
"%p",
sp, k, k + 1);
2320 const char *
s0,
const char *
s1,
2321 const char *
s2,
const char *
s3,
const char *
s4)
2324 int ii[6] = {0,0,0,0,0,0};
2325 void *pp[5] = {0,0,0,0,0};
2336 const char *
ss[5] = {0, 0, 0, 0, 0};
2338 void *pp[5] = {0,0,0,0,0};
2347 void *
p0,
void *
p1,
void *
p2,
void *
p3,
void *
p4)
2349 const char *
ss[5] = {0, 0, 0, 0, 0};
2350 int ii[6] = {0,0,0,0,0,0};
2361 const char *
s1,
const char *
s2,
const char *
s3)
2364 int ii[6] = {
i0,0,0,0,0,0};
2365 void *pp[5] = {0,0,0,0,0};
2376 const char *
ss[5] = {
s0,0,0,0,0};
2378 void *pp[5] = {0,0,0,0,0};
2387 int i0,
int i1,
unsigned int ui)
2389 const char *
ss[5] = {
s0,0,0,0,0};
2390 int ii[6] = {
i0,
i1,0,0,0,0};
2391 void *pp[5] = {0,0,0,0,0};
2402 const char *
ss[5] = {
s0,
s1,0,0,0};
2404 void *pp[5] = {0,0,0,0,0};
2413 const char *
s0,
const char *
s1,
const char *
s2)
2415 const char *
ss[5] = {
s0,
s1,
s2,0,0};
2416 int ii[6] = {
i0,
i1,0,0,0,0};
2417 void *pp[5] = {0,0,0,0,0};
2427 const char *
s1,
const char *
s2,
2429 const char *
s3,
const char *
s4)
2432 int ii[6] = {
i0,
i1,0,0,0,0};
2433 void *pp[5] = {0,0,0,0,0};
2442 int i0,
int i1,
const char *
s1,
2443 const char *
s2,
const char *
s3)
2446 int ii[6] = {
i0,
i1,0,0,0,0};
2447 void *pp[5] = {0,0,0,0,0};
2456 const char *
s1,
const char *
s2,
2457 int i0,
unsigned int ui)
2459 const char *
ss[5] = {
s0,
s1,
s2,0,0};
2460 int ii[6] = {
i0,0,0,0,0,0};
2461 void *pp[5] = {0,0,0,0,0};
2470 const char *
s0,
const char *
s1)
2472 const char *
ss[5] = {
s0,
s1,0,0,0};
2474 void *pp[5] = {0,0,0,0,0};
2484 const char *
s1,
const char *
s2,
const char *
s3,
int i0)
2487 int ii[6] = {
i0,0,0,0,0,0};
2488 void *pp[5] = {0,0,0,0,0};
2497 int i3,
const char *
s0)
2499 const char *
ss[5] = {
s0,0,0,0,0};
2501 void *pp[5] = {0,0,0,0,0};
2511 const char *
ss[5] = {0,0,0,0,0};
2512 int ii[6] = {
i0,
i1,0,0,0,0};
2513 void *pp[5] = {
p0,0,0,0,0};
2524 const char *
ss[5] = {0,0,0,0,0};
2526 void *pp[5] = {
p0,0,0,0,0};
2537 const char *
ss[5] = {0,0,0,0,0};
2539 void *pp[5] = {
p0,0,0,0,0};
2548 void *
p0,
int i2,
int i3)
2550 const char *
ss[5] = {0,0,0,0,0};
2552 void *pp[5] = {
p0,0,0,0,0};
2562 const char *
ss[5] = {0,0,0,0,0};
2563 int ii[6] = {
i0,
i1,0,0,0,0};
2564 void *pp[5] = {
p0,0,0,0,0};
2573 const char *
s0,
void *
p0,
int i0,
int i1)
2575 const char *
ss[5] = {
s0,0,0,0,0};
2576 int ii[6] = {
i0,
i1,0,0,0,0};
2577 void *pp[5] = {
p0,0,0,0,0};
2586 void *
p0,
const char *
s0,
int i0)
2588 const char *
ss[5] = {
s0,0,0,0,0};
2589 int ii[6] = {
i0,0,0,0,0,};
2590 void *pp[5] = {
p0,0,0,0,0};
2599 const char *
s0,
const char *
s1,
void *
p0)
2601 const char *
ss[5] = {
s0,
s1,0,0,0};
2602 int ii[6] = {0,0,0,0,0,0};
2603 void *pp[5] = {
p0,0,0,0,0};
2612 const char *
s0,
const char *
s1,
int i1,
int i2)
2614 const char *
ss[5] = {
s0,
s1,0,0,0};
2616 void *pp[5] = {0,0,0,0,0};
2625 const char *
s0,
int i1,
int i2)
2627 const char *
ss[5] = {
s0,0,0,0,0};
2629 void *pp[5] = {0,0,0,0,0};
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define TRACE(Flag, Args)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
int SetHostInDirectives(const char *, XrdProofdDirective *d, void *h)
Set host field for directive 'd' to (const char *h)
int DoDirectiveInt(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Process directive for an integer.
int DoDirectiveClass(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Generic class directive processor.
int DoDirectiveString(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Process directive for a string.
#define IDXTOLET(ilet, x)
#define LETTOIDX(x, ilet)
#define XpdBadPGuard(g, u)
#define XrdSysMutexHelper
int Get(int &i)
Get next token and interpret it as an int.
int Init(const char *buf)
Init from buffer.
static int ChangeOwn(const char *path, XrdProofUI ui)
Change the ownership of 'path' to the entity described by 'ui'.
static int GetUserInfo(const char *usr, XrdProofUI &ui)
Get information about user 'usr' in a thread safe way.
static int MvDir(const char *oldpath, const char *newpath)
Move content of directory at oldpath to newpath.
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 ...
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,...
static int ParseUsrGrp(const char *path, XrdOucString &usr, XrdOucString &grp)
Parse a path in the form of "<usr>[.<grp>][.<pid>]", filling 'usr' and 'grp'.
static int AssertDir(const char *path, XrdProofUI ui, bool changeown)
Make sure that 'path' exists and is owned by the entity described by 'ui'.
static int VerifyProcessByID(int pid, const char *pname="proofserv")
Check if a process named 'pname' and process 'pid' is still in the process table.
static long int GetLong(char *str)
Extract first integer from string at 'str', if any.
static const char * ProofRequestTypes(int type)
Translates the proof request type in a human readable string.
static int KillProcess(int pid, bool forcekill, XrdProofUI ui, bool changeown)
Kill the process 'pid'.
static bool HasToken(const char *s, const char *tokens)
Returns true is 's' contains at least one of the comma-separated tokens in 'tokens'.
static int GetGroupInfo(const char *grp, XrdProofGI &gi)
Get information about group with 'gid' in a thread safe way.
static int ChangeToDir(const char *dir, XrdProofUI ui, bool changeown)
Change current directory to 'dir'.
static int ChangeMod(const char *path, unsigned int mode)
Change the permission mode of 'path' to 'mode'.
static int GetNumCPUs()
Find out and return the number of CPUs in the local machine.
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,...
static int ReadMsg(int fd, XrdOucString &msg)
Receive 'msg' from pipe fd.
static int GetIDFromPath(const char *path, XrdOucString &emsg)
Extract an integer from a file.
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...
static XrdSysRecMutex fgFormMutex
static void LogEmsgToFile(const char *flog, const char *emsg, const char *pfx=0)
Logs error message 'emsg' to file 'flog' using standard technology.
static int RmDir(const char *path)
Remove directory at path and its content.
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.
static const char * AdminMsgType(int type)
Translates the admin message type in a human readable string.
static int CheckIf(XrdOucStream *s, const char *h)
Check existence and match condition of an 'if' directive If none (valid) is found,...
static char * Expand(char *p)
Expand path 'p' relative to: $HOME if begins with ~/ <user>'s $HOME if begins with ~<user>/ $PWD if d...
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'.
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'.
XrdOucString Export(int &next)
Export 'next' token; use next < 0 start from the first.
bool Matches(const char *s)
Return true if 's' is compatible with this token.
void Init(const char *s)
Init the multi-string token.
XrdOucString Export()
Return a string with comma-separated elements.
void Init(const char *s)
Init the multi-string handler.
std::list< XrdProofdMultiStrToken > fTokens
XrdOucString Get(int i)
Return i-th combination (i : 0 -> fN-1)
bool Matches(const char *s)
Return true if 's' is compatible with this multi-string.
int Recv(XpdMsg &msg)
Recv message from the pipe.
int Poll(int to=-1)
Poll over the read pipe for to secs; return whatever poll returns.
void Close()
If open, close and invalidated the pipe descriptors.
XrdProofdPipe()
Constructor: create the pipe.
virtual ~XrdProofdPipe()
Destructor.
int Post(int type, const char *msg)
Post message on the pipe.
int changeown(const std::string &path, uid_t u, gid_t g)
Change the ownership of 'path' to the entity described by {u,g}.