IOXD_CONFIG(3)libioxd Programmer's ManualIOXD_CONFIG(3)

NAME

ioxd/config.h - the runtime's knobs: the ring, the receive buffers, the coroutine stacks and the pools, per worker. Set once before ioxd_run; the build's values are the defaults.

SYNOPSIS

#include <ioxd.h>

typedef struct { ... } ioxd_config;
int ioxd_configure(const ioxd_config *config);

DESCRIPTION

typedef struct ioxd_config {
    unsigned ring_entries;      /* submission queue entries, the completion queue twice that; a power of two, at most 32768; 4096 */
    unsigned recv_buffers;      /* provided receive buffers; a power of two, at most 32768; 4096 */
    unsigned recv_buffer_size;  /* bytes in each, 64 to 1 MB; 2048 */
    size_t   stack_size;        /* a connection's coroutine stack, above a 64 KB guard; at least 64 KB; 128 KB */
    unsigned idle_stacks;       /* stacks kept warm for the next connections; 512 */
    unsigned idle_connections;  /* connection records kept warm; 1024 */
} ioxd_config;

Every field is per worker, and a zero field keeps its default. The receive buffers are what the kernel delivers into, so their count bounds how much may be in flight before recvs park on -ENOBUFS (the log says "raise recv_buffers" when that happens) and their size bounds what one delivery holds; a worker's slab is count x size bytes.

int ioxd_configure(const ioxd_config *config);

Apply a configuration to the runs that follow. -1, with the reason on stderr, when a value is refused - nothing changes then. ioxd_configure(&(ioxd_config){ 0 }) is the defaults.

EXAMPLES

Twice the receive buffers, before the run; every other field keeps its default:

ioxd_config config = { .recv_buffers = 8192 };
if (ioxd_configure(&config) < 0)
    return 1;                                   /* the reason is on stderr */
ioxd_bind(8080, NULL);
return ioxd_run(0);

SEE ALSO

ioxd_http(3), ioxd_router(3), ioxd_slice(3), ioxd_json(3), ioxd_pipe(3), ioxd_tls(3), ioxd_examples(7), ioxd(7)

libioxd 0.1.02026-09-09IOXD_CONFIG(3)