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

#include <XrdSysError.hh>

Collaboration diagram for XrdSysError:

Public Member Functions

 XrdSysError (XrdSysLogger *lp, const char *ErrPrefix="sys")
 ~XrdSysError ()
int baseFD ()
int ec2errno (int ecode)
void Emsg (const char *esfx, const char *text1, const char *text2=0, const char *text3=0)
int Emsg (const char *esfx, int ecode, const char *text1, const char *text2=0)
int getMsgMask ()
void Log (int mask, const char *esfx, const char *text1, const char *text2=0, const char *text3=0)
XrdSysLoggerlogger (XrdSysLogger *lp=0)
void Say (const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
void setMsgMask (int mask)
const char * SetPrefix (const char *prefix)
void TBeg (const char *txt1=0, const char *txt2=0, const char *txt3=0)
void TEnd ()

Static Public Member Functions

static void addTable (XrdSysError_Table *etp)
static void addTable (XrdSysError_Table_Errno *etp)
static const char * ec2text (int ecode)

Detailed Description

Definition at line 117 of file XrdSysError.hh.

Constructor & Destructor Documentation

◆ XrdSysError()

XrdSysError::XrdSysError ( XrdSysLogger * lp,
const char * ErrPrefix = "sys" )
inline

Definition at line 120 of file XrdSysError.hh.

121 : epfx(0),
122 epfxlen(0),
123 msgMask(-1),
124 Logger(lp)
125 { SetPrefix(ErrPrefix); }
static XrdSysLogger Logger
const char * SetPrefix(const char *prefix)

References SetPrefix().

Here is the call graph for this function:

◆ ~XrdSysError()

XrdSysError::~XrdSysError ( )
inline

Definition at line 127 of file XrdSysError.hh.

127{}

Member Function Documentation

◆ addTable() [1/2]

void XrdSysError::addTable ( XrdSysError_Table * etp)
inlinestatic

Definition at line 134 of file XrdSysError.hh.

134{etp->next = etab; etab = etp;}

Referenced by XrdOssSys::Configure().

Here is the caller graph for this function:

◆ addTable() [2/2]

void XrdSysError::addTable ( XrdSysError_Table_Errno * etp)
inlinestatic

Definition at line 136 of file XrdSysError.hh.

136{etp->next = etab_errno; etab_errno = etp;}

◆ baseFD()

int XrdSysError::baseFD ( )

Definition at line 74 of file XrdSysError.cc.

74{return Logger->originalFD();}

◆ ec2errno()

int XrdSysError::ec2errno ( int ecode)

Definition at line 96 of file XrdSysError.cc.

97{
98 int xcode = 0;
99 XrdSysError_Table_Errno *etp = etab_errno;
100
101 int sign = (ecode < 0 ? -1 : 1);
102 int absE = ecode * sign;
103
104 while ((etp != 0) && !(xcode = etp->Lookup(absE)))
105 etp = etp->next;
106
107 // if errcode is mapped return
108 // otherwise return the original err code
109 return xcode ? xcode * sign : ecode;
110}

References XrdSysError_Table_Errno::Lookup().

Here is the call graph for this function:

◆ ec2text()

const char * XrdSysError::ec2text ( int ecode)
static

Definition at line 80 of file XrdSysError.cc.

81{
82 int xcode;
83 const char *etxt = 0;
84 XrdSysError_Table *etp = etab;
85
86 xcode = (ecode < 0 ? -ecode : ecode);
87 while((etp != 0) && !(etxt = etp->Lookup(xcode))) etp = etp->next;
88 if (!etxt) etxt = XrdSysE2T(xcode);
89 return etxt;
90}
const char * XrdSysE2T(int errcode)
Definition XrdSysE2T.cc:104
char * Lookup(int mnum)

References XrdSysError_Table::Lookup(), and XrdSysE2T().

Referenced by Emsg(), and XrdOucERoute::Format().

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

◆ Emsg() [1/2]

void XrdSysError::Emsg ( const char * esfx,
const char * text1,
const char * text2 = 0,
const char * text3 = 0 )

Definition at line 138 of file XrdSysError.cc.

141{
142 struct iovec iov[16];
143 int iovpnt = 0;
144
145 Set_IOV_Item(0,0); // 0
146 if (epfx && epfxlen) Set_IOV_Item(epfx, epfxlen); // 1
147 if (esfx ) Set_IOV_Buff(esfx); // 2
148 Set_IOV_Item(": ", 2); // 3
149 Set_IOV_Buff(txt1); // 4
150 if (txt2 && txt2[0]){Set_IOV_Item(" ", 1); // 5
151 Set_IOV_Buff(txt2);} // 6
152 if (txt3 && txt3[0]){Set_IOV_Item(" ", 1); // 7
153 Set_IOV_Buff(txt3);} // 8
154 Set_IOV_Item("\n", 1); // 9
155 Logger->Put(iovpnt, iov);
156}
#define Set_IOV_Item(x, y)
#define Set_IOV_Buff(x)

References Set_IOV_Buff, and Set_IOV_Item.

◆ Emsg() [2/2]

int XrdSysError::Emsg ( const char * esfx,
int ecode,
const char * text1,
const char * text2 = 0 )

Definition at line 116 of file XrdSysError.cc.

118{
119 struct iovec iov[16];
120 int iovpnt = 0;
121 const char *etxt = ec2text(ecode);
122
123 Set_IOV_Item(0,0); // 0
124 if (epfx && epfxlen) Set_IOV_Item(epfx, epfxlen); // 1
125 if (esfx ) Set_IOV_Buff(esfx); // 2
126 Set_IOV_Item(": Unable to ", 12); // 3
127 Set_IOV_Buff(txt1); // 4
128 if (txt2 && txt2[0]){Set_IOV_Item(" ", 1); // 5
129 Set_IOV_Buff(txt2); } // 6
130 Set_IOV_Item("; ", 2); // 7
131 Set_IOV_Buff(etxt); // 8
132 Set_IOV_Item("\n", 1); // 9
133 Logger->Put(iovpnt, iov);
134
135 return ecode;
136}
static const char * ec2text(int ecode)

References ec2text(), Set_IOV_Buff, and Set_IOV_Item.

Referenced by XrdOuca2x::a2fm(), XrdOuca2x::a2fm(), XrdOuca2x::a2i(), XrdOuca2x::a2ll(), XrdOuca2x::a2sn(), XrdOuca2x::a2sp(), XrdOuca2x::a2sz(), XrdOuca2x::a2tm(), XrdOuca2x::a2vp(), XrdNetSocket::Accept(), Macaroons::Handler::Config(), XrdNetPMarkCfg::Config(), XrdAccConfig::ConfigDB(), XrdOssSys::ConfigProc(), XrdOssSys::ConfigStage(), XrdOssSys::ConfigStageC(), XrdBwm::Configure(), XrdCephOss::Configure(), XrdOfs::Configure(), XrdOssSys::Configure(), XrdVomsMapfile::Configure(), XrdOfs::ConfigXeq(), XrdOssSys::ConfigXeq(), XrdTlsTempCA::TempCAGuard::create(), XrdPollE::Disable(), XrdPollPoll::Disable(), XrdPollPoll::doDetach(), XrdPollE::Enable(), XrdPollPoll::Enable(), XrdPollE::Exclude(), XrdPollPoll::Exclude(), XrdPollE::Include(), XrdPollPoll::Include(), XrdOfsEvr::Init(), XrdOucN2N::lfn2pfn(), Log(), XrdXrootdAdmin::Login(), main(), XrdPoll::newPoller(), XrdOfsEvs::Parse(), XrdOucPsx::ParseCache(), XrdOucPsx::ParseCio(), XrdOucPsx::ParseCLib(), XrdOucExport::ParseDefs(), XrdHttpProtocol::parseHeader2CGI(), XrdOucPsx::ParseINet(), XrdOucPsx::ParseMLib(), XrdOucPsx::ParseNLib(), XrdOucExport::ParsePath(), XrdOucPsx::ParseSet(), XrdOucPsx::ParseTrace(), XrdOucERoute::Route(), TagPath::SetPrefix(), XrdOucProg::Setup(), XrdBwmLogger::Start(), XrdOfsEvs::Start(), XrdPollE::Start(), XrdPollPoll::Start(), XrdOssSys::xalloc(), XrdOssSys::xcachescan(), XrdOssSys::xfdlimit(), XrdOssSys::xmaxsz(), XrdOssSys::xmemf(), XrdOssSys::xnml(), xonmissing(), XrdOssSys::xpath(), XrdOssSys::xprerd(), XrdAccAuthorizeObjAdd(), XrdAccAuthorizeObject(), XrdHttpGetExtHandler(), XrdHttpGetExtHandler(), XrdOssAddStorageSystem2(), XrdSysThread_Xeq(), XrdOssSys::xspace(), XrdOssSys::xspace(), XrdOssSys::xspaceBuild(), XrdOssSys::xstg(), XrdOssSys::xstl(), XrdOssSys::xtrace(), XrdOssSys::xusage(), and XrdOssSys::xxfr().

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

◆ getMsgMask()

int XrdSysError::getMsgMask ( )
inline

Definition at line 190 of file XrdSysError.hh.

190{return msgMask;}

Referenced by XrdVomsMapfile::Configure().

Here is the caller graph for this function:

◆ Log()

void XrdSysError::Log ( int mask,
const char * esfx,
const char * text1,
const char * text2 = 0,
const char * text3 = 0 )
inline

Definition at line 167 of file XrdSysError.hh.

171 {if (mask & msgMask) Emsg(esfx, text1, text2, text3);}
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)

References Emsg().

Here is the call graph for this function:

◆ logger()

XrdSysLogger * XrdSysError::logger ( XrdSysLogger * lp = 0)
inline

Definition at line 175 of file XrdSysError.hh.

176 {XrdSysLogger *oldp = Logger;
177 if (lp) Logger = lp;
178 return oldp;
179 }

Referenced by TPC::TPCHandler::TPCHandler(), XrdScheduler::XrdScheduler(), XrdOssSys::ConfigStage(), XrdOssSys::ConfigStatLib(), XrdHttpProtocol::Configure(), XrdXrootdProtocol::Configure(), XrdCmsConfig::Configure0(), and XrdSysGetXAttrObject().

Here is the caller graph for this function:

◆ Say()

void XrdSysError::Say ( const char * text1,
const char * text2 = 0,
const char * txt3 = 0,
const char * text4 = 0,
const char * text5 = 0,
const char * txt6 = 0 )

Definition at line 162 of file XrdSysError.cc.

164{
165 struct iovec iov[9];
166 int iovpnt = 0;
167 if (txt1) Set_IOV_Buff(txt1) // 0
168 else Set_IOV_Item(0,0);
169 if (txt2 && txt2[0]) Set_IOV_Buff(txt2); // 1
170 if (txt3 && txt3[0]) Set_IOV_Buff(txt3); // 2
171 if (txt4 && txt4[0]) Set_IOV_Buff(txt4); // 3
172 if (txt5 && txt5[0]) Set_IOV_Buff(txt5); // 4
173 if (txt6 && txt6[0]) Set_IOV_Buff(txt6); // 5
174 Set_IOV_Item("\n", 1); // 6
175 Logger->Put(iovpnt, iov);
176}

References Set_IOV_Buff, and Set_IOV_Item.

Referenced by Macaroons::Handler::Config(), XrdNetPMarkCfg::Config(), XrdOfs::Config_Display(), XrdOssSys::Config_Display(), XrdAccConfig::ConfigDB(), XrdOssSys::ConfigMio(), XrdOssSys::ConfigProc(), XrdOssSys::ConfigSpace(), XrdOssSys::ConfigSpath(), XrdOssSys::ConfigStage(), XrdAccConfig::Configure(), XrdBwm::Configure(), XrdOfs::Configure(), XrdOssSys::Configure(), XrdBwm::ConfigXeq(), XrdOfs::ConfigXeq(), XrdOssSys::ConfigXeq(), XrdOssMio::Display(), XrdSecEntity::Display(), XrdOssCsiConfig::Init(), XrdOssCache::List(), XrdOssSys::List_Path(), XrdNetPMarkCfg::Parse(), XrdOfsEvs::Parse(), XrdOucPsx::ParseCLib(), XrdOucPsx::ParseSet(), XrdOucPsx::ParseTrace(), XrdOssSys::xcache(), XrdOssSys::xmemf(), XrdDigGetFS(), XrdgetProtocol(), XrdOssAddStorageSystem2(), XrdOucGetCache(), XrdSfsGetFileSystem(), XrdOssSys::xspace(), XrdOssSys::xspaceBuild(), and XrdOssSys::xtrace().

Here is the caller graph for this function:

◆ setMsgMask()

void XrdSysError::setMsgMask ( int mask)
inline

Definition at line 188 of file XrdSysError.hh.

188{msgMask = mask;}

Referenced by Macaroons::Handler::Config(), and XrdVomsMapfile::Configure().

Here is the caller graph for this function:

◆ SetPrefix()

const char * XrdSysError::SetPrefix ( const char * prefix)
inline

Definition at line 194 of file XrdSysError.hh.

195 {const char *oldpfx = epfx;
196 epfx = prefix; epfxlen = strlen(epfx);
197 return oldpfx;
198 }

Referenced by XrdSysError().

Here is the caller graph for this function:

◆ TBeg()

void XrdSysError::TBeg ( const char * txt1 = 0,
const char * txt2 = 0,
const char * txt3 = 0 )

Definition at line 182 of file XrdSysError.cc.

183{
184 std::cerr <<Logger->traceBeg();
185 if (txt1) std::cerr <<txt1 <<' ';
186 if (txt2) std::cerr <<epfx <<txt2 <<": ";
187 if (txt3) std::cerr <<txt3;
188}

◆ TEnd()

void XrdSysError::TEnd ( )

Definition at line 194 of file XrdSysError.cc.

194{std::cerr <<std::endl; Logger->traceEnd();}

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