iob_new(3)

πŸ“¦
version 0.33 Β· 3 versions
, in debian bookworm, debian trixie, opensuse-leap 16.0, ubuntu noble, ubuntu questing

✨ NAME ✨

iob_new β€” create new I/O batch. This is iob_new(3) from the Library Functions Manual, and we are literally so back bestie πŸ«ΆπŸ’…

🌸 SYNTAX 🌸

#include <libowfat/iob.h>

io_batch* iob_new(int hint_entries);

πŸ’– DESCRIPTION πŸ’–

okay so 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 β€” no secret meaning, no lore β€” so if you are unsure, just pass 1 and move on ✨.

You can add buffers, strings and files to an I/O batch and then send it all at once using iob_send. It's giving "gather everything, then send it together" energy πŸŽ€.

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). That's the whole point and it ate πŸ”₯.

πŸ¦‹ 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. So yeah, check that pointer before you start acting brand new 😭.

πŸŽ€ SEE ALSO πŸŽ€


that's the whole page from the Library Functions Manual β€” iob_new(3) β€” and the footer just says iob_new(3) again, with no date listed, so that's the cute little sign-off bestie πŸ«ΆπŸ’œ