gensio_write(3)
π gensio_write β write data to a gensio π
okay bestie, this is a page from the Library Functions Manual and it's literally the manual page for gensio_write(3), which β as the NAME section already told you β writes data to a gensio. slay. let's get into it π¦
β¨ NAME β¨
gensio_write β Write data to a gensio π
πΈ SYNOPSIS πΈ
#include <gensio/gensio.h>
int gensio_write(struct gensio *io, gensiods *count,
const void *buf, gensiods buflen,
const char *const *auxdata);
struct gensio_sg {
const void *buf;
gensiods buflen;
};
int gensio_write_sg(struct gensio *io, gensiods *count,
const struct gensio_sg *sg, gensiods sglen,
const char *const *auxdata);
π DESCRIPTION π
so you wanna write data to the given gensio. the data lives in buf and the length of that data is in buflen. easy. BUT β and this is the plot twist β gensio_write may not write all of the data you gave it, because it depends on the gensio type and how much internal buffer space there is. it will return the number of bytes actually written in count, and count may be NULL if you don't care. (hint: you should almost always care. i'm not even being dramatic, bestie, that's the manpage talking π)
if gensio_write can't write the full amount of data, you should generally buffer the unwritten data and call gensio_set_write_callback_enable(3) so you know when you can write the rest of it. and the way that a lot of applications do it for consistency? they always buffer the data and enable the write callback to do the write, then disable the write callback once all the data is written. it's giving consistent. it's giving reliable. periodt. π
gensio_write will never block β if it can't write all the data, it writes what it can and returns. no sitting around waiting, she's got places to be β¨
auxdata is how you pass in gensio-specific auxiliary data, like the stream number for SCTP, or whether the data is out-of-band data for SCTP or TCP. iykyk π«Ά
gensio_write_sg is like gensio_write, except it takes a scatter-gather structure so you can combine multiple chunks of data without copying. so efficient, so iconic. π
but heads up: if you get a partial write, you have to figure out where the write ended in your scatter-gather list and start the next write from there. that part's on you, babe. no cap.
β RETURN VALUES β
zero is returned on success, or a gensio error on failure. that's it, that's the whole vibe check. π
π SEE ALSO π
fr fr, go read those too, they're part of the lore π§
and that's a wrap on this page, bestie π this was from the Library Functions Manual, dated 24 Feb 2019, filed under gensio_write(3). mwah, go write some bytes. πβ¨
π¦ where this page comes from
- alpine 3.22: gensio-doc 2.8.14-r0 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- alpine 3.23: gensio-doc 2.8.14-r0 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- alpine 3.24: gensio-doc 2.8.14-r0 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- arch rolling: gensio 3.0.4-1 Β· GPL
- debian bookworm: libgensio-dev 2.6.2-4 Β· GPL-2.0-only
- debian trixie: libgensio-dev 2.8.13-7 Β· GPL-2.0-only
- epel 9: libgensio-devel 2.8.15-1.el9 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 43: libgensio-devel 2.8.15-5.fc43 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 43: libgensio-devel 2.8.15-5.fc43 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 43: libgensio-devel 3.0.4-1.fc43 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 43: libgensio-devel 3.0.4-1.fc43 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 44: libgensio-devel 3.0.2-1.fc44 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 44: libgensio-devel 3.0.2-1.fc44 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 44: libgensio-devel 3.0.4-1.fc44 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- fedora 44: libgensio-devel 3.0.4-1.fc44 Β· GPL-2.0-only AND LGPL-2.1-only AND Apache-2.0
- nixos 26.05: gensio 3.0.2
- nixpkgs unstable: gensio 3.0.2
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- opensuse-leap 16.0: gensio-devel 2.8.2-bp160.1.13 Β· Apache-2.0 AND GPL-2.0-only AND LGPL-2.1-only
- ubuntu jammy: libgensio-dev 2.3.5-1build2 Β· GPL-2.0-only
- ubuntu noble: libgensio-dev 2.8.2-6.1build1 Β· GPL-2.0-only
- ubuntu questing: libgensio-dev 2.8.13-7
- ubuntu resolute: libgensio-dev 3.0.0-1build1 Β· GPL-2.0-only
- ubuntu stonking: libgensio-dev 3.0.0-1ubuntu1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms