48 void *ptr = malloc(
sizeof(
io_ctx_t));
int io_ctx_notify_fork(io_ctx_t *ctx, enum io_fork_event e)
Notifies all registered I/O services of the specified fork event.
void io_ctx_destroy(io_ctx_t *ctx)
Destroys an I/O context.
void io_ctx_insert(io_ctx_t *ctx, struct io_svc *svc)
Registers an I/O service with an I/O context.
io_ctx_t * io_ctx_create(void)
Creates a new I/O context.
void io_ctx_shutdown(io_ctx_t *ctx)
Shuts down all registered I/O services in reverse order of registration.
void io_ctx_remove(io_ctx_t *ctx, struct io_svc *svc)
Unregisters an I/O service with an I/O context.
This header file is part of the I/O library; it contains the I/O context and service declarations.
io_fork_event
The type of event generated by an I/O context before and after a process fork.
@ IO_FORK_PREPARE
The event generated before the fork.
void dllist_push_back(struct dllist *list, struct dlnode *node)
Pushes a node to the back of a doubly-linked list.
void dllist_init(struct dllist *list)
Initializes a doubly-linked list.
struct dlnode * dllist_last(const struct dllist *list)
Returns a pointer to the last node in a doubly-linked list.
struct dlnode * dllist_first(const struct dllist *list)
Returns a pointer to the first node in a doubly-linked list.
void dllist_remove(struct dllist *list, struct dlnode *node)
Removes a node from a doubly-linked list.
This header file is part of the utilities library; it contains the native and platform-independent er...
int get_errc(void)
Returns the last (thread-specific) native error code set by a system call or library function.
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
int errno2c(int errnum)
Transforms a standard C error number to a native error code.
This is the public header file of the utilities library.
#define structof(ptr, type, member)
Obtains the address of a structure from the address of one of its members.
This is the internal header file of the I/O library.
This header file is part of the C11 and POSIX compatibility library; it includes <stdlib....
A node in a doubly-linked list.
struct dlnode * next
A pointer to the next node in the list.
struct dlnode * prev
A pointer to the previous node in the list.
The virtual table of an I/O service.
int(* notify_fork)(struct io_svc *svc, enum io_fork_event e)
A pointer to the function to be called by io_ctx_notify_fork() (can be NULL).
void(* shutdown)(struct io_svc *svc)
A pointer to the function to be called by io_ctx_shutdown() (can be NULL).
const struct io_svc_vtbl * vptr
A pointer to the virtual table for the I/O service.
This header file is part of the C11 and POSIX compatibility library; it includes <threads....
int mtx_init(mtx_t *mtx, int type)
Creates a mutex object with properties indicated by type, which must have one of the four values:
int mtx_lock(mtx_t *mtx)
Blocks until it locks the mutex at mtx.
@ thrd_success
Indicates that the requested operation succeeded.
int mtx_unlock(mtx_t *mtx)
Unlocks the mutex at mtx.
void mtx_destroy(mtx_t *mtx)
Releases any resources used by the mutex at mtx.
@ mtx_plain
A mutex type that supports neither timeout nor test and return.