XRootD
XrdSys Namespace Reference

Namespaces

 IOEvents
 

Classes

class  KernelBuffer
 
class  RAtomic
 
class  RAtomic< bool >
 
class  RAtomic< T * >
 
struct  shm
 
struct  shm_error
 

Functions

int getIovMax ()
 
ssize_t Move (char *&ubuff, KernelBuffer &kbuff, size_t length)
 
ssize_t Move (KernelBuffer &kbuff, char *&ubuff)
 
ssize_t Read (int fd, KernelBuffer &buffer, uint32_t length)
 
ssize_t Read (int fd, KernelBuffer &buffer, uint32_t length, int64_t offset)
 
ssize_t Send (int fd, KernelBuffer &buffer)
 
ssize_t Write (int fd, KernelBuffer &buffer, int64_t offset)
 

Variables

static const int PageBits = 12
 
static const int PageMask = 4095
 
static const int PageSize = 4096
 

Detailed Description

IOEvents

The classes here define a simple I/O event polling architecture suitable for use with non-blocking devices. As it implements an event model, it is not considered a high performance interface. For increased performance, you need to use multiple polling event loops which effectively implements a limited thread model for handling events. The implementation here is similar to libEvent with better handling of timeouts and I/O polling resumption.

While, channels are multi-thread safe, they cannot interlock with the state of their file descriptor. You must first disable (via SetFD()) or delete the channel before closing its associated file descriptor. This is the only safe way to keep channels and their file descriptors synchronized.

Function Documentation

◆ getIovMax()

int XrdSys::getIovMax ( )
Returns
: maximum size of I/O vector

Definition at line 77 of file XrdSysPlatform.cc.

78 {
79 #ifndef IOV_MAX
80 #ifdef _SC_IOV_MAX
81  static int IOV_MAX = []() {
82  int sc_iov_max = sysconf(_SC_IOV_MAX);
83  return sc_iov_max > 0 ? sc_iov_max : 1024;
84  }();
85 #else
86 #define IOV_MAX 1024
87 #endif
88 #endif
89  return IOV_MAX;
90 }
#define IOV_MAX

References IOV_MAX.

◆ Move() [1/2]

ssize_t XrdSys::Move ( char *&  ubuff,
KernelBuffer kbuff,
size_t  length 
)
inline

Utility function for moving a user space buffer to kernel space.

See also
KernelBuffer::FromUser

Definition at line 462 of file XrdSysKernelBuffer.hh.

463  {
464  return kbuff.FromUser( ubuff, length );
465  }

◆ Move() [2/2]

ssize_t XrdSys::Move ( KernelBuffer kbuff,
char *&  ubuff 
)
inline

Utility function for moving a kernel buffer to user space.

See also
KernelBuffer::ToUser

Definition at line 452 of file XrdSysKernelBuffer.hh.

453  {
454  return kbuff.ToUser( ubuff );
455  }

Referenced by XrdCl::FileStateHandler::Write(), and XrdCl::XRootDMsgHandler::WriteMessageBody().

+ Here is the caller graph for this function:

◆ Read() [1/2]

ssize_t XrdSys::Read ( int  fd,
KernelBuffer buffer,
uint32_t  length 
)
inline

Utility function for reading data from a file descriptor into a kernel buffer.

See also
KernelBuffer::ReadFromFD

Definition at line 421 of file XrdSysKernelBuffer.hh.

422  {
423  return buffer.ReadFromFD( fd, length, NULL );
424  }

◆ Read() [2/2]

ssize_t XrdSys::Read ( int  fd,
KernelBuffer buffer,
uint32_t  length,
int64_t  offset 
)
inline

Utility function for reading data from a file descriptor into a kernel buffer.

See also
KernelBuffer::ReadFromFD

Definition at line 410 of file XrdSysKernelBuffer.hh.

411  {
412  return buffer.ReadFromFD( fd, length, &offset );
413  }

Referenced by XrdCl::FileStateHandler::Write().

+ Here is the caller graph for this function:

◆ Send()

ssize_t XrdSys::Send ( int  fd,
KernelBuffer buffer 
)
inline

Utility function for sending data from a kernel buffer into a socket.

See also
KernelBuffer::WriteToFD

Definition at line 442 of file XrdSysKernelBuffer.hh.

443  {
444  return buffer.WriteToFD( fd, NULL );
445  }

Referenced by XrdFrmMonitor::Ident(), XrdFrmMonitor::Map(), and XrdCl::Socket::Send().

+ Here is the caller graph for this function:

◆ Write()

ssize_t XrdSys::Write ( int  fd,
KernelBuffer buffer,
int64_t  offset 
)
inline

Utility function for writing data from a kernel buffer into a file descriptor.

See also
KernelBuffer::WriteToFD

Definition at line 432 of file XrdSysKernelBuffer.hh.

433  {
434  return buffer.WriteToFD( fd, &offset );
435  }

Variable Documentation

◆ PageBits

const int XrdSys::PageBits = 12
static

Definition at line 38 of file XrdSysPageSize.hh.

◆ PageMask

const int XrdSys::PageMask = 4095
static

Definition at line 37 of file XrdSysPageSize.hh.

◆ PageSize