68 if (!
fDir.endswith(
'/'))
fDir +=
"/";
82 fDir.replace(
"<effuser>",
fgUI.fUser);
84 fDir.replace(
"<user>",
ui.fUser);
89 if (!
fDir.endswith(
'/'))
95 if (!
fDir.endswith(
'/'))
106 XrdOucString path,
sb;
112 fErrMsg +=
"unable to create work dir: ";
121 fErrMsg +=
"unable to create work dir: ";
129 const char *
basicdirs[4] = {
"/cache",
"/packages",
"/.creds",
"/queries" };
131 int n = (full) ? 4 : 3;
132 for (i = 0; i <
n; i++) {
136 fErrMsg +=
"unable to create dir: ";
159 XrdOucString ll(*
lhs);
160 ll.erase(ll.rfind(
'-'));
161 ll.erase(0, ll.rfind(
'-')+1);
165 XrdOucString
rr(*
rhs);
166 rr.erase(
rr.rfind(
'-'));
167 rr.erase(0,
rr.rfind(
'-')+1);
171 return ((
tl <
tr) ? 0 : 1);
181static void Sort(std::list<XrdOucString *> *
lst)
192 XrdOucString **
ta =
new XrdOucString *[
lst->size()];
193 std::list<XrdOucString *>::iterator i;
199 XrdOucString *
tmp = 0;
258 opt = (opt >= 0 && opt <= 3) ? opt : 0;
261 if ((opt < 3 && !
sdirs) || (opt == 3 && !tag)) {
280 if (!
strncmp(ent->d_name,
"session-", 8)) {
282 if (opt == 3 && tag->length() > 0) {
283 if (
strstr(ent->d_name, tag->c_str())) {
291 fterm += ent->d_name;
292 fterm +=
"/.terminated";
294 if ((opt == 1 &&
rc == 0) || (opt == 2 &&
rc != 0))
300 sdirs->push_back(
new XrdOucString(ent->d_name));
316 return ((opt == 3 && found) ? 1 : 0);
348 TRACE(
XERR,
"cannot open file "<<
fn<<
" for appending (errno: "<<
errno<<
")");
363 std::list<XrdOucString *>
actln;
408 bool last = (tag ==
"last") ? 1 : 0;
410 if (!last && tag.length() > 0) {
451 " for reading (errno: "<<
errno<<
")");
458 std::list<XrdOucString *>
staglst;
465 found = (
rc == 1) ? 1 : 0;
467 if (!found && !
staglst.empty()) {
470 tag =
staglst.front()->c_str();
476 std::list<XrdOucString *>::iterator i;
492 tag.replace(
"session-",
"");
494 TRACE(
DBG,
"tag "<<tag<<
" not found in dir");
499 return ((found) ? 0 : -1);
546 std::list<XrdOucString *>
actln;
556 actln.push_back(
new XrdOucString(
ln));
571 if (!
actln.empty()) {
573 std::list<XrdOucString *>::iterator i;
595 fterm += (
strstr(tag,
"session-")) ?
"/" :
"/session-";
597 fterm +=
"/.terminated";
625 fnact +=
"/.sessions";
646 TRACE(
XERR,
"could not get privileges to trim directories");
651 if (
tobemv.length() > 0) {
657 TRACE(
XERR,
"problems tagging session as old in sandbox");
665 std::list<XrdOucString *>
staglst;
674 std::list<XrdOucString *>::iterator i;
682 XrdOucString *s =
staglst.back();
686 XrdOucString
rmcmd =
"/bin/rm -rf ";
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 del
#define XpdBadPGuard(g, u)
bool XpdSessionTagComp(XrdOucString *&lhs, XrdOucString *&rhs)
Compare times from session tag strings.
const_iterator begin() const
const_iterator end() const
static int GetUserInfo(const char *usr, XrdProofUI &ui)
Get information about user 'usr' in a thread safe way.
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.
XrdProofdSandbox(XrdProofUI ui, bool full, bool changeown)
Assert existence on the sandbox for the user defined by 'ui'.
static XrdOucString fgWorkdir
static int fgMaxOldSessions
int GuessTag(XrdOucString &tag, int ridx=1)
Guess session tag completing 'tag' (typically "-<pid>") by scanning the active session file or the se...
int AddSession(const char *tag)
Record entry for new proofserv session tagged 'tag' in the active sessions file (<SandBox>/....
int GetSessionDirs(int opt, std::list< XrdOucString * > *sdirs, XrdOucString *tag=0)
Scan the sandbox for sessions working dirs and return their sorted (according to creation time,...
int TrimSessionDirs()
If the static fgMaxOldLogs > 0, logs for a fgMaxOldLogs number of sessions are kept in the sandbox; w...
int RemoveSession(const char *tag)
Move record for tag from the active sessions file to the old sessions file (<SandBox>/....
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Sort the n elements of the array a of generic templated type Element.
int changeown(const std::string &path, uid_t u, gid_t g)
Change the ownership of 'path' to the entity described by {u,g}.