XRootD
Loading...
Searching...
No Matches
XrdMpxOut Class Reference
+ Collaboration diagram for XrdMpxOut:

Classes

struct  statsBuff
 

Public Member Functions

 XrdMpxOut ()
 
 ~XrdMpxOut ()
 
void Add (statsBuff *sbP)
 
statsBuffgetBuff ()
 
void * Run (XrdMpxXml *xP)
 

Detailed Description

Definition at line 67 of file XrdMpxStats.cc.


Class Documentation

◆ XrdMpxOut::statsBuff

struct XrdMpxOut::statsBuff

Definition at line 71 of file XrdMpxStats.cc.

+ Collaboration diagram for XrdMpxOut::statsBuff:
Class Members
char Data[8190]
int Dlen
XrdNetSockAddr From
statsBuff * Next
char Pad[2]

Constructor & Destructor Documentation

◆ XrdMpxOut()

XrdMpxOut::XrdMpxOut ( )
inline

Definition at line 85 of file XrdMpxStats.cc.

85: Ready(0), inQ(0), Free(0) {}

◆ ~XrdMpxOut()

XrdMpxOut::~XrdMpxOut ( )
inline

Definition at line 86 of file XrdMpxStats.cc.

86{}

Member Function Documentation

◆ Add()

void XrdMpxOut::Add ( statsBuff sbP)

Definition at line 101 of file XrdMpxStats.cc.

102{
103
104// Add this to the queue and signal the processing thread
105//
106 myMutex.Lock();
107 sbP->Next = inQ;
108 inQ = sbP;
109 Ready.Post();
110 myMutex.UnLock();
111}

References XrdSysMutex::Lock(), XrdMpxOut::statsBuff::Next, XrdSysSemaphore::Post(), and XrdSysMutex::UnLock().

Referenced by main().

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

◆ getBuff()

XrdMpxOut::statsBuff * XrdMpxOut::getBuff ( )

Definition at line 117 of file XrdMpxStats.cc.

118{
119 statsBuff *sbP;
120
121// Use an available buffer or allocate one
122//
123 myMutex.Lock();
124 if ((sbP = Free)) Free = sbP->Next;
125 else sbP = new statsBuff;
126 myMutex.UnLock();
127 return sbP;
128}

References XrdSysMutex::Lock(), XrdMpxOut::statsBuff::Next, and XrdSysMutex::UnLock().

Referenced by main().

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

◆ Run()

void * XrdMpxOut::Run ( XrdMpxXml xP)

Definition at line 134 of file XrdMpxStats.cc.

135{
136 XrdNetAddr theAddr;
137 const char *Host = 0;
138 char *bP, obuff[sizeof(statsBuff)*2];
139 statsBuff *sbP;
140 int wLen, rc;
141
142// Simply loop formating and outputing the buffers
143//
144 while(1)
145 {Ready.Wait();
146 myMutex.Lock();
147 if ((sbP = inQ)) inQ = sbP->Next;
148 myMutex.UnLock();
149 if (!sbP) continue;
150 if (xP)
151 {if (!(Opts & addSender)) Host = 0;
152 else if (theAddr.Set(&(sbP->From.Addr))) Host = 0;
153 else Host = theAddr.Name();
154 wLen = xP->Format(Host, sbP->Data, obuff);
155 bP = obuff;
156 } else {
157 bP = sbP->Data;
158 *(bP + sbP->Dlen) = '\n';
159 wLen = sbP->Dlen+1;
160 }
161
162 while(wLen > 0)
163 {do {rc = write(STDOUT_FILENO, bP, wLen);}
164 while(rc < 0 && errno == EINTR);
165 wLen -= rc; bP += rc;
166 }
167
168 myMutex.Lock(); sbP->Next = Free; Free = sbP; myMutex.UnLock();
169 }
170
171// Should never get here
172//
173 return (void *)0;
174}
#define write(a, b, c)
Definition XrdPosix.hh:110
int Format(const char *Host, char *ibuff, char *obuff)
Definition XrdMpxXml.cc:242
const char * Name(const char *eName=0, const char **eText=0)
const char * Set(const char *hSpec, int pNum=PortInSpec)
static const int addSender

References XrdMpx::addSender, XrdMpxXml::Format(), XrdSysMutex::Lock(), XrdNetAddrInfo::Name(), XrdMpxOut::statsBuff::Next, XrdMpx::Opts, XrdNetAddr::Set(), XrdSysMutex::UnLock(), XrdSysSemaphore::Wait(), and write.

Referenced by mainOutput().

+ 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 file: