---
name: "iom_add"
section: "3"
platform: "linux"
package: "libowfat-dev"
version: "0.32-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/iom_add"
---

# iom\_add(3)

add event to I/O multiplexer

## NAME

iom\_add - add event to I/O multiplexer

## SYNTAX

**#include \<libowfat/io.h\>**

int **iom\_add**(iomux\_t\* c, int64 fd, unsigned int events);

## DESCRIPTION

iom\_add adds an event you are interested in to an I/O multiplexer.

*fd* is the file descriptor (usually a socket) you are interested in, and *events* is the operation you want to do. It can be IOM\_READ or IOM\_WRITE.

If that operation becomes possible on that descriptor, and some thread is calling *iom\_wait* at the time, it will return and tell you the fd and the event.

Note that the event registration is removed from the iomux\_t context if it occurs. You will have to call *iom\_wait* again after you handled the event, if you are still interested in it.

Closing a file descriptor with registered events will discard the event registration.

## LINKING

You may have to add *-lpthread* to the command line in the linking step.

## RETURN VALUE

iom\_add returns 0 on success and -1 on error, setting errno.

## SEE ALSO

iom\_init, iom\_wait, iom\_abort
