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

# iob\_new(3)

create new I/O batch

## NAME

iob\_new - create new I/O batch

## SYNTAX

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

io\_batch\* **iob\_new**(int hint\_entries);

## DESCRIPTION

iob\_new creates a new I/O batch with enough space allocated for *hint\_entries* entries (buffers or files).  This is purely a performance hint, if you are unsure just pass 1.

You can add buffers, strings and files to an I/O batch and then send it all at once using iob\_send.

The benefit of the I/O batch API is that it exploits platform specific APIs like FreeBSD's sendfile.  The file contents will always be sent in a way that allows the operating systems to perform zero copy TCP, and the buffers will always be sent using as few syscalls as possible and avoiding unnecessary copying (using writev).

## RETURN VALUE

iob\_new returns a pointer to an I/O batch data structure.  If there was a memory allocation error, it returns NULL instead.

## SEE ALSO

[iob\_reset(3)](/iob_reset/3.md), [iob\_send(3)](/iob_send/3.md), [iob\_addbuf(3)](/iob_addbuf/3.md), [iob\_adds\_free(3)](/iob_adds_free/3.md), [iob\_addfile(3)](/iob_addfile/3.md)
