xrootd
Loading...
Searching...
No Matches
Static Public Member Functions | Static Private Member Functions | List of all members
XrdSys::shm Struct Reference

#include <XrdSysShmem.hh>

Static Public Member Functions

static std::tuple< void *, size_t > create (const std::string &name, size_t size)
 
template<typename T >
static std::tuple< T *, size_t > get (const std::string &name)
 
template<typename T >
static std::tuple< T *, size_t > make_array (const std::string &name, size_t count)
 
template<typename T , typename... Args>
static std::tuple< T *, size_t > make_array (const std::string &name, size_t count, Args &&... args)
 

Static Private Member Functions

static void * map_shm (int fd, size_t size)
 

Detailed Description

Utility class for creating and obtaining shared emory

Member Function Documentation

◆ create()

static std::tuple< void *, size_t > XrdSys::shm::create ( const std::string &  name,
size_t  size 
)
inlinestatic

Helper function for creating shared memory block

Parameters
name: name of the shared memory block (shared memory object should be identified by a name of the form /somename)
size: size of the shared memory segment
Returns
: pointer to the shared memory and its size

References close, fstat, ftruncate, map_shm(), and stat.

Referenced by make_array(), and make_array().

◆ get()

template<typename T >
static std::tuple< T *, size_t > XrdSys::shm::get ( const std::string &  name)
inlinestatic

Helper function for getting shared memory block

Parameters
name: name of the shared memory block (shared memory object should be identified by a name of the form /somename)
Returns
: pointer to the shared memory and its size

References close, fstat, map_shm(), and stat.

◆ make_array() [1/2]

template<typename T >
static std::tuple< T *, size_t > XrdSys::shm::make_array ( const std::string &  name,
size_t  count 
)
inlinestatic

Helper function for creating a shared memory block and constructing an array of objects of type T (constructed with default constructor) within the block.

Parameters
name: name of the shared memory block (shared memory object should be identified by a name of the form /somename)
count: size of the array
Returns
: pointer to the shared memory and its size

References create().

◆ make_array() [2/2]

template<typename T , typename... Args>
static std::tuple< T *, size_t > XrdSys::shm::make_array ( const std::string &  name,
size_t  count,
Args &&...  args 
)
inlinestatic

Helper function for creating a shared memory block and constructing an array of objects of type T (constructed with using arguments args) within the block.

Parameters
name: name of the shared memory block (shared memory object should be identified by a name of the form /somename)
count: size of the array
args: the arguments for the T constructor
Returns
: pointer to the shared memory and its size

References create().

◆ map_shm()

static void * XrdSys::shm::map_shm ( int  fd,
size_t  size 
)
inlinestaticprivate

Helper function for mapping the shared memory block into user virtual address space

Parameters
fd: handle to the shared memory segment
size: size of the shared memory segment
Returns
: pointer to the shared memory

Referenced by create(), and get().


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