lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Ipc Namespace Reference

POSIX shared-memory and message-queue helpers for the DRP. More...

Functions

int setupDrpShMem (std::string key, size_t size, int &shmId)
 Open (creating if needed) the POSIX shared memory object key with mode 0666, store its descriptor in shmId and resize it to size bytes.
 
int attachDrpShMem (std::string key, int &shmId, size_t size, void *&data, bool write)
 Map size bytes of the shared memory descriptor shmId (read-only, or write-only when write is true) and store the address in data.
 
int detachDrpShMem (void *&data, int size)
 Unmap size bytes at data; returns the munmap() result.
 
int setupDrpMsgQueue (std::string key, size_t mqSize, int &mqId, bool write)
 Open (creating if needed) the POSIX message queue key, write-only or read-only per write, holding one message of up to mqSize bytes, and store its descriptor in mqId.
 
int detachDrpMq (void *&data, int size)
 Declared here; IpcUtils.cc defines only detachDrpMq(std::string key), which unlinks the queue, so this signature has no definition.
 
int drpSend (int mqId, const char *msg, size_t msgsize)
 Send msgsize bytes from msg on queue mqId with priority 31; returns the mq_send() result.
 
int drpRecv (int mqId, char *msg, size_t msgsize, unsigned msTmo)
 Receive one message into msg (up to msgsize bytes) from queue mqId, waiting up to msTmo milliseconds.
 
int cleanupDrpShmMem (std::string key, int shmId)
 Close shmId if it is non-zero and unlink the shared memory object key; returns the shm_unlink() result.
 
int cleanupDrpMq (std::string key, int mqId)
 Close mqId if it is non-zero and unlink the message queue key; returns the mq_unlink() result.
 

Detailed Description

POSIX shared-memory and message-queue helpers for the DRP.

Function Documentation

◆ attachDrpShMem()

int Pds::Ipc::attachDrpShMem ( std::string  key,
int &  shmId,
size_t  size,
void *&  data,
bool  write 
)

Map size bytes of the shared memory descriptor shmId (read-only, or write-only when write is true) and store the address in data.

Returns 0, or -1 if mmap() fails; key is not used.

◆ cleanupDrpMq()

int Pds::Ipc::cleanupDrpMq ( std::string  key,
int  mqId 
)

Close mqId if it is non-zero and unlink the message queue key; returns the mq_unlink() result.

◆ cleanupDrpShmMem()

int Pds::Ipc::cleanupDrpShmMem ( std::string  key,
int  shmId 
)

Close shmId if it is non-zero and unlink the shared memory object key; returns the shm_unlink() result.

◆ detachDrpMq()

int Pds::Ipc::detachDrpMq ( void *&  data,
int  size 
)

Declared here; IpcUtils.cc defines only detachDrpMq(std::string key), which unlinks the queue, so this signature has no definition.

◆ detachDrpShMem()

int Pds::Ipc::detachDrpShMem ( void *&  data,
int  size 
)

Unmap size bytes at data; returns the munmap() result.

◆ drpRecv()

int Pds::Ipc::drpRecv ( int  mqId,
char *  msg,
size_t  msgsize,
unsigned  msTmo 
)

Receive one message into msg (up to msgsize bytes) from queue mqId, waiting up to msTmo milliseconds.

Returns 0, or -1 on error or timeout. The nanosecond part of the deadline is not normalized, so it can exceed one second.

◆ drpSend()

int Pds::Ipc::drpSend ( int  mqId,
const char *  msg,
size_t  msgsize 
)

Send msgsize bytes from msg on queue mqId with priority 31; returns the mq_send() result.

◆ setupDrpMsgQueue()

int Pds::Ipc::setupDrpMsgQueue ( std::string  key,
size_t  mqSize,
int &  mqId,
bool  write 
)

Open (creating if needed) the POSIX message queue key, write-only or read-only per write, holding one message of up to mqSize bytes, and store its descriptor in mqId.

Returns 0, or -1 if mq_open() fails.

◆ setupDrpShMem()

int Pds::Ipc::setupDrpShMem ( std::string  key,
size_t  size,
int &  shmId 
)

Open (creating if needed) the POSIX shared memory object key with mode 0666, store its descriptor in shmId and resize it to size bytes.

Returns the ftruncate() result, or -1 if shm_open() fails.