Condy v1.5.0
C++ Asynchronous System Call Layer for Linux
Loading...
Searching...
No Matches
condy::FdTable Class Reference

File descriptor table for io_uring. More...

#include <ring.hpp>

Public Member Functions

int init (size_t capacity) noexcept
 Initialize the file descriptor table with the given capacity.
int init (const int *fds, unsigned nr_fds)
 Initialize the file descriptor table with the given array of file descriptors.
int destroy () noexcept
 Destroy the file descriptor table.
int update (unsigned index_base, const int *fds, unsigned nr_fds) noexcept
 Update the file descriptor table starting from the given index.
template<typename Func>
void set_fd_accepter (Func &&accepter)
 Set the accepter function for incoming file descriptors.
int set_file_alloc_range (unsigned offset, unsigned size) noexcept
 Set the file allocation range for the fd table.

Friends

auto async_fixed_fd_send (FdTable &dst, int source_fd, int target_fd, unsigned int flags)
 See io_uring_prep_msg_ring_fd.

Detailed Description

File descriptor table for io_uring.

This class makes an abstraction over the io_uring file registration interface.

Definition at line 24 of file ring.hpp.

Member Function Documentation

◆ destroy()

int condy::FdTable::destroy ( )
inlinenoexcept

Destroy the file descriptor table.

Returns
int Returns 0 on success or a negative error code on failure

Definition at line 58 of file ring.hpp.

◆ init() [1/2]

int condy::FdTable::init ( const int * fds,
unsigned nr_fds )
inline

Initialize the file descriptor table with the given array of file descriptors.

Parameters
fdsPointer to the array of file descriptors to register
nr_fdsNumber of file descriptors in the array
Returns
int Returns 0 on success or a negative error code on failure

Definition at line 50 of file ring.hpp.

◆ init() [2/2]

int condy::FdTable::init ( size_t capacity)
inlinenoexcept

Initialize the file descriptor table with the given capacity.

Parameters
capacityThe number of file descriptors to allocate in the table
Returns
int Returns 0 on success or a negative error code on failure

Definition at line 39 of file ring.hpp.

◆ set_fd_accepter()

template<typename Func>
void condy::FdTable::set_fd_accepter ( Func && accepter)
inline

Set the accepter function for incoming file descriptors.

User can use async_fixed_fd_send() to send a fixed fd to the fd table of another Runtime. This function sets the accepter function that will be called when such an operation is performed.

Template Parameters
FuncThe type of the accepter function
Parameters
accepterThe accepter function to set, which accepts an int32_t parameter representing the fixed file descriptor index being received.
Deprecated
This function is deprecated and will be removed in a future version.

Definition at line 86 of file ring.hpp.

◆ set_file_alloc_range()

int condy::FdTable::set_file_alloc_range ( unsigned offset,
unsigned size )
inlinenoexcept

Set the file allocation range for the fd table.

Parameters
offsetThe starting offset of the file allocation range
sizeThe size of the file allocation range
Returns
int Returns 0 on success or a negative error code on failure

Definition at line 96 of file ring.hpp.

◆ update()

int condy::FdTable::update ( unsigned index_base,
const int * fds,
unsigned nr_fds )
inlinenoexcept

Update the file descriptor table starting from the given index.

Parameters
index_baseThe starting index to update
fdsPointer to the array of file descriptors
nr_fdsNumber of file descriptors to update
Returns
int Return number of file descriptors updated on success or a negative error code on failure

Definition at line 68 of file ring.hpp.

◆ async_fixed_fd_send

auto async_fixed_fd_send ( FdTable & dst,
int source_fd,
int target_fd,
unsigned int flags )
friend

See io_uring_prep_msg_ring_fd.

Deprecated
This operation is deprecated and will be removed in a future version.

Definition at line 1005 of file async_operations.hpp.


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