ark::seekable_fd class

An io object, denotes a lseek()-able fd as defined in kernel.

Stores the offset within, as the kernel offset has race problems and undefined behaviors on error. The offset is auto increased on completion of io operations.

Base classes

class with_async_context
able to bound to an async_context

Derived classes

class mem_fd
wraps fildes created by memfd_create(2) as an io object
class normal_file
wraps fildes that represents an normal file as an io object

Public static variables

static bool seekable constexpr

Constructors, destructors, conversion operators

seekable_fd() protected noexcept
constructs an empty seekable_fd
seekable_fd(int fd_int) protected noexcept
constructs an seekable_fd with fildes fd_int and offset set to 0

Public functions

auto close() -> result<void> noexcept
call close() on the fd
auto get() const -> int noexcept
returns the int fildes
auto offset() const -> clinux::off_t noexcept
returns the offset of next io operations
void seek(clinux::off_t off) noexcept
sets the offset of next io operations
void feed(clinux::off_t rel_off) noexcept
similar to seek(offset() + rel_off)

Function documentation

result<void> ark::seekable_fd::close() noexcept

call close() on the fd

if the object is empty, the operation succeeds.