lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
IpcUtils.hh File Reference

POSIX shared-memory and message-queue helpers used between the DRP and its Python workers. More...

#include <sys/ipc.h>

Namespaces

namespace  Pds
 Outer namespace of the HSD digitizer helpers.
 
namespace  Pds::Ipc
 POSIX shared-memory and message-queue helpers for the DRP.
 

Functions

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.
 
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.
 
int Pds::Ipc::detachDrpShMem (void *&data, int size)
 Unmap size bytes at data; returns the munmap() result.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 

Detailed Description

POSIX shared-memory and message-queue helpers used between the DRP and its Python workers.