NNG_AIO_SET_IOV(3)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

✨ nng_aio_set_iov ✨

okay bestie come CLOSE, we're talking about nng_aio_set_iov from the NNG Reference Manual (section 3 of the manual, if you care about that kind of thing, and you should 🫢). It's giving "set the scatter/gather vector" energy and honestly? iconic.


🌸 NAME 🌸

nng_aio_set_iov β€” set scatter/gather vector πŸ’–


🌈 SYNOPSIS 🌈

#include <nng/nng.h>

int nng_aio_set_iov(nng_aio *aio, unsigned int niov, nng_iov *iov);

πŸŽ€ DESCRIPTION πŸŽ€

so literally, what nng_aio_set_iov() does is it sets a scatter/gather vector iov on the handle aio. that's it, that's the job. main character behaviour, no notes. πŸ‘‘

the iov is a pointer to an array of niov nng_iov structures, and those bad boys look like this:

typedef struct nng_iov {
    void * iov_buf;
    size_t iov_len;
};

here's the part where you go "wait, do I have to malloc this?" β€” nope bestie, breathe. 🧚 the iov gets copied into storage inside the aio itself, so you can absolutely use stack-allocated nng_iov structures and go on with your day. HOWEVER (and this is important, don't skip it πŸ™ˆ): the values that the iov_buf members point to are not copied by this function. only the structs get copied. the actual buffers stay wherever you put them. iykyk.

a maximum of four (4) nng_iov members may be supplied. that's 4, not 5. yes, four.

Note πŸ“ earlier versions of the library could accept longer scatter/gather lists. but here's the tea: no known consumers have ever needed a scatter/gather list longer than 4 vectors. so the implementation limit got reduced, and the heap allocations that could fail were removed. slay, honestly β€” fewer ways for things to go wrong. πŸ’…

⭐ RETURN VALUES ⭐

this function returns 0 on success, and non-zero otherwise. that's the whole vibe check. ✨


πŸ’€ ERRORS πŸ’€

  • NNG_EINVAL β€” the value of the specified niov is too large. (you tried to sneak in more than four vectors, didn't you. we saw that. 😭)

πŸ¦‹ SEE ALSO πŸ¦‹

go read those too, they're all part of the same little family and they all ate. πŸ”₯


k that's the whole page, you're officially smarter than you were three minutes ago, obsessed with that for you πŸ’œ this lil manual page came straight out of the NNG Reference Manual and it's dated 2026-06-30 β€” keep that date in your heart, periodt. bye bestie, go set some vectors πŸŽ€βœ¨

πŸ“¦ where this page comes from