XRootD
Loading...
Searching...
No Matches
XrdPosixConfig Class Reference

#include <XrdPosixConfig.hh>

+ Collaboration diagram for XrdPosixConfig:

Public Member Functions

 XrdPosixConfig ()
 
 ~XrdPosixConfig ()
 

Static Public Member Functions

static XrdSecsssConconTracker (bool debug=false)
 
static void EnvInfo (XrdOucEnv &theEnv)
 
static void initStat (struct stat *buf)
 
static bool OpenFC (const char *path, int oflag, mode_t mode, XrdPosixInfo &Info)
 
static bool SetConfig (XrdOucPsx &parms)
 
static void SetEnv (const char *kword, int kval)
 
static void setOids (bool isok)
 
static int Stats (const char *theID, char *buff, int blen)
 

Detailed Description

Definition at line 46 of file XrdPosixConfig.hh.

Constructor & Destructor Documentation

◆ XrdPosixConfig()

XrdPosixConfig::XrdPosixConfig ( )
inline

Definition at line 68 of file XrdPosixConfig.hh.

68{}

◆ ~XrdPosixConfig()

XrdPosixConfig::~XrdPosixConfig ( )
inline

Definition at line 69 of file XrdPosixConfig.hh.

69{}

Member Function Documentation

◆ conTracker()

XrdSecsssCon * XrdPosixConfig::conTracker ( bool debug = false)
static

Definition at line 150 of file XrdPosixConfig.cc.

151{
153 ConCleanup *cuHandler = new ConCleanup(pm, dbg);
154 std::unique_ptr<ConTrack> ctHandler(new ConTrack(*cuHandler, dbg));
155
156// Set the callback for new connections
157//
158 pm->SetOnConnectHandler( std::move( ctHandler ) );
159
160// Return the connection cleanup handler. Note that we split the task into
161// two objects so that we don't violate the semantics of unique pointer.
162//
163 return cuHandler;
164}
static PostMaster * GetPostMaster()
Get default post master.
A hub for dispatching and receiving messages.
void SetOnConnectHandler(std::unique_ptr< Job > onConnJob)
Set the global connection error handler.

References XrdCl::DefaultEnv::GetPostMaster(), and XrdCl::PostMaster::SetOnConnectHandler().

Referenced by XrdPssSys::ConfigMapID().

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

◆ EnvInfo()

void XrdPosixConfig::EnvInfo ( XrdOucEnv & theEnv)
static

Definition at line 170 of file XrdPosixConfig.cc.

171{
172
173// Extract the pointer to the scheduler from the passed environment
174//
176
177// We no longer propogate the environment to the new-style cache via this
178// method as it picks it up during init time. We leave the code for historical
179// reasons but we really should have gotten rid of EnvInfo()!
180// if (XrdPosixGlobals::myCache2) XrdPosixGlobals::myCache2->EnvInfo(theEnv);
181
182// Test if XRDCL_EC is set. That env var. is set at XrdCl::PlugInManager::LoadFactory
183// in XrdClPlugInManager.cc, which is called (by XrdOssGetSS while loading
184// libXrdPss.so) before this function.
185 XrdPosixGlobals::usingEC = getenv("XRDCL_EC")? true : false;
186}
void * GetPtr(const char *varname)
Definition XrdOucEnv.cc:263
XrdOucEnv theEnv
XrdScheduler * schedP

References XrdOucEnv::GetPtr(), XrdPosixGlobals::schedP, and XrdPosixGlobals::usingEC.

Referenced by XrdPssSys::EnvInfo().

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

◆ initStat()

void XrdPosixConfig::initStat ( struct stat * buf)
static

Definition at line 337 of file XrdPosixConfig.cc.

338{
339 static int initStat = 0;
340 static dev_t st_rdev;
341 static dev_t st_dev;
342 static uid_t myUID = getuid();
343 static gid_t myGID = getgid();
344
345// Initialize the xdev fields. This cannot be done in the constructor because
346// we may not yet have resolved the C-library symbols.
347//
348 if (!initStat) {initStat = 1; initXdev(st_dev, st_rdev);}
349 memset(buf, 0, sizeof(struct stat));
350
351// Preset common fields
352//
353 buf->st_blksize= 64*1024;
354 buf->st_dev = st_dev;
355 buf->st_rdev = st_rdev;
356 buf->st_nlink = 1;
357 buf->st_uid = myUID;
358 buf->st_gid = myGID;
359}
#define stat(a, b)
Definition XrdPosix.hh:96
static void initStat(struct stat *buf)

References initStat(), and stat.

Referenced by XrdPosixFile::Fstat(), XrdPosixXrootd::Fstat(), initStat(), and XrdPosixXrootd::Stat().

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

◆ OpenFC()

bool XrdPosixConfig::OpenFC ( const char * path,
int oflag,
mode_t mode,
XrdPosixInfo & Info )
static

Definition at line 385 of file XrdPosixConfig.cc.

387{
388 int rc = XrdPosixXrootd::Open(path, oflag, mode, Info.cbP, &Info);
389
390// Check if we actually can open the file directly via the cache
391//
392 if (rc == -3)
393 {if (*Info.cachePath && errno == 0 && Info.ffReady) return true;
394 rc = -1;
395 if (!errno) errno = ENOPROTOOPT;
396 }
397
398// Return actual result
399//
400 Info.fileFD = rc;
401 return false;
402}
static int Open(const char *path, int oflag, mode_t mode=0, XrdPosixCallBack *cbP=0)

References XrdPosixXrootd::Open().

Referenced by XrdPssFile::Open().

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

◆ SetConfig()

bool XrdPosixConfig::SetConfig ( XrdOucPsx & parms)
static

Definition at line 408 of file XrdPosixConfig.cc.

409{
410 XrdOucTList *tP;
411 const char *val;
412
413// Set log routing
414//
417
418// Create an error object if we have a logger
419//
420 if (parms.theLogger)
421 XrdPosixGlobals::eDest = new XrdSysError(parms.theLogger, "Posix");
422
423// Set networking mode
424//
425 SetIPV4(parms.useV4);
426
427// Handle the Name2Name for pfn2lfn translations.
428//
429 if (parms.xPfn2Lfn)
431 if (parms.xPfn2Lfn == parms.xP2Lsrc || parms.xPfn2Lfn == parms.xP2Lsgi)
435 }
436
437// Handle client settings
438//
439 if ((tP = parms.setFirst))
440 do {SetEnv(tP->text, tP->val);
441 tP = tP->next;
442 } while(tP);
443
444// Handle debug and trace settings
445//
446 if (parms.traceLvl || parms.debugLvl)
447 {if (parms.debugLvl) SetDebug(parms.debugLvl);
448 else SetDebug(parms.traceLvl);
450 }
451
452// Handle number of response handlers we should keep
453//
454 if (parms.maxRHCB > 0) XrdPosixFileRH::SetMax(parms.maxRHCB);
455
456// Set delayed destro parameters if present
457//
458 if (parms.cioWait > 0 && parms.cioTries > 0)
459 {XrdPosixGlobals::ddMaxTries = (parms.cioTries < 2 ? 2 : parms.cioTries);
460 XrdPosixGlobals::ddInterval = (parms.cioWait < 10 ? 10 : parms.cioWait);
461 }
462
463// Set auto conversion of read to pgread
464//
465 if (parms.theCache && parms.theEnv && (val = parms.theEnv->Get("psx.CSNet")))
466 {if (*val == '1' || *val == '2')
468 if (*val == '2') SetEnv("WantTlsOnNoPgrw", 1);
469 }
470 }
471
472// Handle the caching options (library or builin memory).
473// TODO: Make the memory cache a library plugin as well.
474//
475 if (parms.theCache)
477 if (parms.initCCM) return initCCM(parms);
478 return true;
479 }
480 else if (parms.mCache && *parms.mCache) initEnv(parms.mCache);
481
482 return true;
483}
#define TRACE_Debug
char * Get(const char *varname)
Definition XrdOucEnv.hh:69
XrdOucEnv * theEnv
Definition XrdOucPsx.hh:80
bool useV4
Definition XrdOucPsx.hh:92
int maxRHCB
Definition XrdOucPsx.hh:87
static const int xP2Lsgi
Definition XrdOucPsx.hh:100
char * mCache
Definition XrdOucPsx.hh:84
int traceLvl
Definition XrdOucPsx.hh:88
int cioTries
Definition XrdOucPsx.hh:91
char xPfn2Lfn
Definition XrdOucPsx.hh:94
XrdOucCache * theCache
Definition XrdOucPsx.hh:82
int cioWait
Definition XrdOucPsx.hh:90
XrdOucTList * setFirst
Definition XrdOucPsx.hh:85
static const int xP2Lsrc
Definition XrdOucPsx.hh:99
int debugLvl
Definition XrdOucPsx.hh:89
XrdOucName2Name * theN2N
Definition XrdOucPsx.hh:81
XrdOucCacheCMInit_t initCCM
Definition XrdOucPsx.hh:83
XrdSysLogger * theLogger
Definition XrdOucPsx.hh:79
XrdOucTList * next
static void SetEnv(const char *kword, int kval)
static void SetMax(int mval)
void SetLogger(XrdSysLogger *logp)
XrdSysLogger * theLogger
XrdSysError * eDest
XrdOucCache * theCache
XrdOucName2Name * theN2N
XrdSysTrace Trace

References XrdPosixGlobals::autoPGRD, XrdOucPsx::cioTries, XrdOucPsx::cioWait, XrdPosixGlobals::ddInterval, XrdPosixGlobals::ddMaxTries, XrdOucPsx::debugLvl, XrdPosixGlobals::eDest, XrdOucEnv::Get(), XrdOucPsx::initCCM, XrdOucPsx::maxRHCB, XrdOucPsx::mCache, XrdOucTList::next, XrdPosixGlobals::p2lSGI, XrdPosixGlobals::p2lSRC, SetEnv(), XrdOucPsx::setFirst, XrdSysTrace::SetLogger(), XrdPosixFileRH::SetMax(), XrdOucTList::text, XrdOucPsx::theCache, XrdPosixGlobals::theCache, XrdOucPsx::theEnv, XrdOucPsx::theLogger, XrdPosixGlobals::theLogger, XrdOucPsx::theN2N, XrdPosixGlobals::theN2N, XrdPosixGlobals::Trace, TRACE_Debug, XrdOucPsx::traceLvl, XrdOucPsx::useV4, XrdSysTrace::What, XrdOucPsx::xP2Lsgi, XrdOucPsx::xP2Lsrc, and XrdOucPsx::xPfn2Lfn.

Referenced by XrdPosixXrootd::XrdPosixXrootd().

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

◆ SetEnv()

void XrdPosixConfig::SetEnv ( const char * kword,
int kval )
static

Definition at line 509 of file XrdPosixConfig.cc.

510{
512 static bool dlfSet = false;
513
514// Check for internal envars before setting the external one
515//
516 if (!strcmp(kword, "DirlistAll"))
519 dlfSet = true;
520 }
521 else if (!strcmp(kword, "DirlistDflt"))
522 {if (!dlfSet)
525 }
526 else env->PutInt((std::string)kword, kval);
527}
static Env * GetEnv()
Get default client environment.
bool PutInt(const std::string &key, int value)
Definition XrdClEnv.cc:110
XrdCl::DirListFlags::Flags dlFlag
@ None
Nothing special.

References XrdPosixGlobals::dlFlag, XrdCl::DefaultEnv::GetEnv(), XrdCl::DirListFlags::Locate, XrdCl::DirListFlags::None, and XrdCl::Env::PutInt().

Referenced by SetConfig(), and XrdFfsMisc_xrd_init().

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

◆ setOids()

void XrdPosixConfig::setOids ( bool isok)
static

Definition at line 547 of file XrdPosixConfig.cc.

548{
550}

References XrdPosixGlobals::oidsOK.

◆ Stats()

int XrdPosixConfig::Stats ( const char * theID,
char * buff,
int blen )
static

Definition at line 556 of file XrdPosixConfig.cc.

557{
558 static const char stats1[] = "<stats id=\"%s\">"
559 "<open>%lld<errs>%lld</errs></open>"
560 "<close>%lld<errs>%lld</errs></close>"
561 "</stats>";
562
563 static const char stats2[] = "<stats id=\"cache\" type=\"%s\">"
564 "<prerd><in>%lld</in><hits>%lld</hits><miss>%lld</miss></prerd>"
565 "<rd><in>%lld</in><out>%lld</out>"
566 "<hits>%lld</hits><miss>%lld</miss>"
567 "</rd>"
568 "<pass>%lld<cnt>%lld</cnt></pass>"
569 "<wr><out>%lld</out><updt>%lld</updt></wr>"
570 "<saved>%lld</saved><purge>%lld</purge>"
571 "<files><opened>%lld</opened><closed>%lld</closed><new>%lld</new>"
572 "<del>%lld</del><now>%lld</now><full>%lld</full>"
573 "</files>"
574 "<store><size>%lld</size><used>%lld</used>"
575 "<min>%lld</min><max>%lld</max>"
576 "</store>"
577 "<mem><size>%lld</size><used>%lld</used><wq>%lld</wq></mem>"
578 "<opcl><odefer>%lld</odefer><defero>%lld</defero>"
579 "<cdefer>%lld</cdefer><clost>%lld</clost>"
580 "</opcl>"
581 "</stats>";
582
583// If the caller want the maximum length, then provide it.
584//
585 if (!blen)
586 {size_t n;
587 int len1, digitsLL = strlen("9223372036854775807");
588 std::string fmt = stats1;
589 n = std::count(fmt.begin(), fmt.end(), '%');
590 len1 = fmt.size() + (digitsLL*n) - (n*3) + strlen(theID);
591 if (!XrdPosixGlobals::theCache) return len1;
592 fmt = stats2;
593 n = std::count(fmt.begin(), fmt.end(), '%');
594 return len1 + fmt.size() + (digitsLL*n) - (n*3) + 8;
595 }
596
597// Get the standard statistics
598//
601
602// Format the line
603//
604 int k = snprintf(buff, blen, stats1, theID,
605 Y.X.Opens, Y.X.OpenErrs, Y.X.Closes, Y.X.CloseErrs);
606
607// If there is no cache then there nothing to return
608//
609 if (!XrdPosixGlobals::theCache) return k;
610 buff += k; blen -= k;
611
612// Get the statistics
613//
616
617// Format the statisics into the supplied buffer
618//
619 int n = snprintf(buff, blen, stats2, XrdPosixGlobals::theCache->CacheType,
620 Z.X.BytesPead, Z.X.HitsPR, Z.X.MissPR,
621 Z.X.BytesRead, Z.X.BytesGet, Z.X.Hits, Z.X.Miss,
622 Z.X.BytesPass, Z.X.Pass,
623 Z.X.BytesWrite, Z.X.BytesPut,
627 Z.X.DiskSize, Z.X.DiskUsed,
628 Z.X.DiskMin, Z.X.DiskMax,
629 Z.X.MemSize, Z.X.MemUsed, Z.X.MemWriteQ,
632 );
633
634// Return the right value
635//
636 return (n < blen ? n+k : 0);
637}
void Get(XrdOucCacheStats &D)
struct XrdOucCacheStats::CacheStats X
XrdOucCacheStats Statistics
void Get(XrdPosixStats &D)
struct XrdPosixStats::PosixStats X
XrdPosixStats Stats

References XrdOucCacheStats::CacheStats::BytesGet, XrdOucCacheStats::CacheStats::BytesPass, XrdOucCacheStats::CacheStats::BytesPead, XrdOucCacheStats::CacheStats::BytesPurged, XrdOucCacheStats::CacheStats::BytesPut, XrdOucCacheStats::CacheStats::BytesRead, XrdOucCacheStats::CacheStats::BytesSaved, XrdOucCacheStats::CacheStats::BytesWrite, XrdOucCacheStats::CacheStats::ClosDefers, XrdOucCacheStats::CacheStats::ClosedLost, XrdPosixStats::PosixStats::CloseErrs, XrdPosixStats::PosixStats::Closes, XrdOucCacheStats::CacheStats::DeferOpens, XrdOucCacheStats::CacheStats::DiskMax, XrdOucCacheStats::CacheStats::DiskMin, XrdOucCacheStats::CacheStats::DiskSize, XrdOucCacheStats::CacheStats::DiskUsed, XrdOucCacheStats::CacheStats::FilesAreFull, XrdOucCacheStats::CacheStats::FilesClosed, XrdOucCacheStats::CacheStats::FilesCreated, XrdOucCacheStats::CacheStats::FilesInCache, XrdOucCacheStats::CacheStats::FilesOpened, XrdOucCacheStats::CacheStats::FilesPurged, XrdOucCacheStats::Get(), XrdPosixStats::Get(), XrdOucCacheStats::CacheStats::Hits, XrdOucCacheStats::CacheStats::HitsPR, XrdOucCacheStats::CacheStats::MemSize, XrdOucCacheStats::CacheStats::MemUsed, XrdOucCacheStats::CacheStats::MemWriteQ, XrdOucCacheStats::CacheStats::Miss, XrdOucCacheStats::CacheStats::MissPR, XrdOucCacheStats::CacheStats::OpenDefers, XrdPosixStats::PosixStats::OpenErrs, XrdPosixStats::PosixStats::Opens, XrdOucCacheStats::CacheStats::Pass, XrdOucCache::Statistics, XrdPosixGlobals::Stats, XrdPosixGlobals::theCache, XrdOucCacheStats::X, and XrdPosixStats::X.

Referenced by XrdPssSys::Stats().

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

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