Loading...
Searching...
No Matches
XrdFrcCID Class Reference

`#include <XrdFrcCID.hh>`

Collaboration diagram for XrdFrcCID:

## Public Member Functions

| XrdFrcCID ()
| ~XrdFrcCID ()
int | Add (const char *iName, const char *cName, time_t addT, pid_t Pid)
int | Get (const char *iName, char *buff, int blen)
int | Get (const char *iName, const char *vName, XrdOucEnv *evP)
int | Init (const char *qPath)
void | Ref (const char *iName)

## Detailed Description

Definition at line 41 of file XrdFrcCID.hh.

## Constructor & Destructor Documentation

## XrdFrcCID()

XrdFrcCID::XrdFrcCID | ( |  | ) |

inline

Definition at line 54 of file XrdFrcCID.hh.

: Dflt(0), First(0), cidFN(0), cidFN2(0) {}

## ~XrdFrcCID()

XrdFrcCID::~XrdFrcCID | ( |  | ) |

inline

Definition at line 55 of file XrdFrcCID.hh.

{}

## Member Function Documentation

## Add()

int XrdFrcCID::Add | ( | const char * | iName,
|  | const char * | cName,
|  | time_t | addT,
|  | pid_t | Pid )

Definition at line 64 of file XrdFrcCID.cc.

{
cidMon cidMonitor;
cidEnt *cP;
int ckp = 0;
// If this is a new entry, create one
//
if (!(cP = Find(iName)))
{First = new cidEnt(First, iName, cName, addT, Pid);
if (!strcmp(iName, "anon")) Dflt = First;
Update();
return 1;
}
// Ignore this update if this request is older than the previous one
//
if (cP->addT >= addT) return 0;
// Update existing entry
//
if (strcmp(cP->cName, cName))
{free(cP->cName);
cP->cName = strdup(cName);
cP->cNLen = strlen(cName);
ckp = 1;
}
if (cP->Pid != Pid) {cP->Pid = Pid; ckp = 1;}
cP->addT = addT;
if (ckp) Update();
return ckp;
}

## Get() [1/2]

int XrdFrcCID::Get | ( | const char * | iName,
|  | char * | buff,
|  | int | blen )

Definition at line 124 of file XrdFrcCID.cc.

{
cidMon cidMonitor;
cidEnt *cP;
// Find the entry
//
if (!(cP = Find(iName))) {*buff = 0; return 0;}
// Copy out the cluster name
//
strlcpy(buff, cP->cName, blen);
return 1;
}
strlcpy
size_t strlcpy(char *dst, const char *src, size_t sz)
Definition XrdSysPlatform.cc:60

References strlcpy().

Here is the call graph for this function:

## Get() [2/2]

int XrdFrcCID::Get | ( | const char * | iName,
|  | const char * | vName,
|  | XrdOucEnv * | evP )

Definition at line 140 of file XrdFrcCID.cc.

{
cidMon cidMonitor;
cidEnt *cP;
// Find the entry
//
if (!(cP = Find(iName))) return 0;
// Set cluster name in the environment
//
if (vName && evP) evP->Put(vName, cP->cName);
return 1;
}
XrdOucEnv::Put
void Put(const char *varname, const char *value)
Definition XrdOucEnv.hh:85

References XrdOucEnv::Put().

Here is the call graph for this function:

## Init()

int XrdFrcCID::Init | ( | const char * | qPath | ) |

Definition at line 159 of file XrdFrcCID.cc.

{
EPNAME("Init");
XrdOucStream cidFile(&Say);
char Path[1024], *lP, *Pfn;
int cidFD, n, NoGo = 0;
// Construct the appropriate file names
//
strcpy(Path, aPath);
n = strlen(aPath);
if (Path[n-1] != '/') Path[n++] = '/';
Pfn = Path+n;
strcpy(Pfn, "CIDS.new"); cidFN2 = strdup(Path);
strcpy(Pfn, "CIDS"); cidFN = strdup(Path);
// Try to open the cluster checkpoint file.
//
if ( (cidFD = open(cidFN, O_RDONLY, 0)) < 0)
{if (errno == ENOENT) return 0;
Say.Emsg("Init", errno, "open cluster chkpnt file", cidFN);
return 1;
}
cidFile.Attach(cidFD);
// Now start reading records until eof.
//
while((lP = cidFile.GetLine()))
if (*lP)
{DEBUG("Recovering cid entry: " <<lP);
NoGo |= Init(cidFile);
}
// Now check if any errors occurred during file i/o
//
if (NoGo) Say.Emsg("Init", "Errors processing chkpnt file", cidFN);
else if ((n = cidFile.LastError()))
NoGo = Say.Emsg("Init", n, "read cluster chkpnt file", cidFN);
cidFile.Close();
// Return final return code
//
return NoGo;
}
DEBUG
#define DEBUG(x)
Definition XrdBwmTrace.hh:54
EPNAME
#define EPNAME(x)
Definition XrdBwmTrace.hh:56
Say
XrdOucPup XrdCmsParser::Pup & Say
Definition XrdCmsParser.cc:124
open
#define open
Definition XrdPosix.hh:76
Path
XrdOucString Path
Definition XrdSecpwdSrvAdmin.cc:160
XrdFrcCID::Init
int Init(const char *qPath)
Definition XrdFrcCID.cc:159

References XrdOucStream::Attach(), XrdOucStream::Close(), DEBUG, EPNAME, XrdOucStream::GetLine(), Init(), XrdOucStream::LastError(), open, Path, and Say.

Referenced by Init().

Here is the call graph for this function:
Here is the caller graph for this function:

## Ref()

void XrdFrcCID::Ref | ( | const char * | iName | ) |

Definition at line 248 of file XrdFrcCID.cc.

{
cidMon cidMonitor;
cidEnt *cP;
// Find the entry
//
if ((cP = Find(iName))) cP->useCnt = 1;
}

The documentation for this class was generated from the following files:

- XrdFrcCID.hh
- XrdFrcCID.cc