vrtd::QdmaQpair
-
class QdmaQpair
RAII wrapper for a QDMA queue pair (qpair).
A
QdmaQpairowns a qpair created through aSession. It provides convenience methods to start/stop the qpair and to obtain a read/write file descriptor. On destruction, it requests deletion of the qpair.Warning
A
QdmaQpairbecomes invalid if its originatingSessionis closed or moved; methods will throw in that case. The destructor never throws and will silently ignore errors when attempting to delete the qpair.Public Functions
-
inline uint32_t getQid() const noexcept
Qpair identifier as assigned by the kernel.
-
void start()
Start the qpair.
- Throws:
vrtd::Error – on error.
-
void stop()
Stop the qpair.
- Throws:
vrtd::Error – on error.
-
int fd(uint32_t flags = O_CLOEXEC)
Obtain a read/write file descriptor for this qpair.
- Parameters:
flags – OR of O_CLOEXEC and 0 (other flags may be rejected).
- Throws:
vrtd::Error – on error.
- Returns:
New file descriptor owned by the caller.
-
std::fstream fstream(uint32_t flags = O_CLOEXEC, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out | std::ios_base::binary)
Obtain a std::fstream bound to this qpair.
Note
Implementation is Linux-specific and relies on
/proc/self/fd.- Parameters:
flags – OR of O_CLOEXEC and 0 (other flags may be rejected).
mode – Standard iostream open mode (defaults to in|out|binary).
- Throws:
vrtd::Error – or std::runtime_error on error.
- Returns:
A
std::fstreamowning a new file descriptor for this qpair.
-
inline uint32_t getQid() const noexcept