XRootD
XrdOfsPrepGPIReal::PrepGRun Class Reference
+ Inheritance diagram for XrdOfsPrepGPIReal::PrepGRun:
+ Collaboration diagram for XrdOfsPrepGPIReal::PrepGRun:

Public Member Functions

 PrepGRun (XrdOucProg &pgm)
 
void DoIt () override
 
int Run (PrepRequest &req, char *bP=0, int bL=0)
 
void Sched (PrepRequest *rP)
 
- Public Member Functions inherited from XrdJob
 XrdJob (const char *desc="")
 
virtual ~XrdJob ()
 

Public Attributes

PrepGRunnext
 
- Public Attributes inherited from XrdJob
const char * Comment
 
XrdJobNextJob
 

Static Public Attributes

static PrepGRunQ = 0
 

Detailed Description

Definition at line 135 of file XrdOfsPrepGPI.cc.

Constructor & Destructor Documentation

◆ PrepGRun()

XrdOfsPrepGPIReal::PrepGRun::PrepGRun ( XrdOucProg pgm)
inline

Definition at line 147 of file XrdOfsPrepGPI.cc.

147 : prepProg(pgm) {}

Member Function Documentation

◆ DoIt()

void XrdOfsPrepGPIReal::PrepGRun::DoIt ( )
overridevirtual

Implements XrdJob.

Definition at line 229 of file XrdOfsPrepGPI.cc.

230 {
231 
232 // Run as many requests as we can
233 //
234 do{Run(*reqP);
235  delete reqP;
236  gpiMutex.Lock();
237  if ((reqP = PrepRequest::First))
241  } else {
242  next = Q;
243  Q = this;
244  }
245  gpiMutex.UnLock();
246  } while(reqP);
247 }
int Run(PrepRequest &req, char *bP=0, int bL=0)
XrdSysMutex gpiMutex
static PrepRequest * First
static PrepRequest * Last

References XrdOfsPrepGPIReal::PrepRequest::First, XrdOfsPrepGPIReal::gpiMutex, XrdOfsPrepGPIReal::PrepRequest::Last, XrdSysMutex::Lock(), XrdOfsPrepGPIReal::PrepRequest::next, next, Q, Run(), and XrdSysMutex::UnLock().

+ Here is the call graph for this function:

◆ Run()

int XrdOfsPrepGPIReal::PrepGRun::Run ( PrepRequest req,
char *  bP = 0,
int  bL = 0 
)

Definition at line 277 of file XrdOfsPrepGPI.cc.

278 {
279  EPNAME("Run");
280  XrdOucStream cmd;
281  char *lp;
282  int rc, bytes = 0;
283 
284 // Allocate a arg vector of appropriate size
285 //
286  int n = req.argCnt + req.argMem.size();
287  const char **argVec = (const char **)alloca((n+2) * sizeof(char*));
288 
289 // Fill the vector
290 //
291  makeArgs(req, argVec);
292 
293 // Do some debugging
294 //
295  DEBUG(req.tID,"Starting prep for "<<req.reqName<<' '<<req.reqID);
296 
297 // Invoke the program
298 //
299  rc = prepProg.Run(&cmd, argVec, n, req.envVec);
300 
301 // Drain or capture any output
302 //
303  if (!rc)
304  {if (Debug)
305  {DEBUG(req.tID, req.reqName<<' '<<req.reqID<<" output:");}
306  if (!bP) while((lp = cmd.GetLine())) {DEBUG(req.tID," ==> "<<lp);}
307  else bytes = Capture(req, cmd, bP, bL);
308  rc = prepProg.RunDone(cmd);
309  }
310 
311 // Document unsuccessful end
312 //
313  if (rc)
314  {char ib[512];
315  eLog->Emsg("PrepGRun","Prep exec for",req.Info(ib,sizeof(ib)),"failed.");
316  }
317 
318 // Return the error, success or number of bytes
319 //
320  if (bP) return bytes;
321  return (rc ? -1 : 0);
322 }
#define DEBUG(usr, x)
#define EPNAME(x)
int RunDone(XrdOucStream &cmd) const
Definition: XrdOucProg.cc:257
int Run(XrdOucStream *Sp, const char *argV[], int argc=0, const char *envV[]=0) const
Definition: XrdOucProg.cc:108
char * GetLine()
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
XrdSysError * eLog
std::vector< std::string > argMem
const char * Info(char *bP, int bL)

References XrdOfsPrepGPIReal::PrepRequest::argCnt, XrdOfsPrepGPIReal::PrepRequest::argMem, DEBUG, XrdOfsPrepGPIReal::Debug, XrdOfsPrepGPIReal::eLog, XrdSysError::Emsg(), XrdOfsPrepGPIReal::PrepRequest::envVec, EPNAME, XrdOucStream::GetLine(), XrdOfsPrepGPIReal::PrepRequest::Info(), XrdOfsPrepGPIReal::PrepRequest::reqID, XrdOfsPrepGPIReal::PrepRequest::reqName, XrdOucProg::Run(), XrdOucProg::RunDone(), and XrdOfsPrepGPIReal::PrepRequest::tID.

Referenced by DoIt(), and XrdOfsPrepGPIReal::PrepGPI::query().

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

◆ Sched()

void XrdOfsPrepGPIReal::PrepGRun::Sched ( PrepRequest rP)
inline

Definition at line 143 of file XrdOfsPrepGPI.cc.

143  {reqP = rP;
144  schedP->Schedule(this);
145  }
void Schedule(XrdJob *jp)
XrdScheduler * schedP

References XrdOfsPrepGPIReal::schedP, and XrdScheduler::Schedule().

+ Here is the call graph for this function:

Member Data Documentation

◆ next

PrepGRun* XrdOfsPrepGPIReal::PrepGRun::next

Definition at line 149 of file XrdOfsPrepGPI.cc.

Referenced by DoIt(), and XrdOfsgetPrepare().

◆ Q

PrepGRun * XrdOfsPrepGPIReal::PrepGRun::Q = 0
static

Definition at line 150 of file XrdOfsPrepGPI.cc.

Referenced by DoIt().


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