GENSIO_SET_READ_CALLBACK_ENABLE(3)
π gensio_set_read_callback_enable(3) β the callback enable/disable tea π
okay bestie, welcome to gensio_set...back_enable(3), from the Library Functions Manual. this is the page that tells you how to turn your read and write callbacks on and off, and honestly? it's giving main character energy for your whole event loop. let's get into it π«Ά
β¨ NAME β¨
gensio_set_read_callback_enable, gensio_set_write_callback_enable β Enable or disable read data and write ready
like. the whole job. that's it. that's the gig π
πΈ SYNOPSIS πΈ
#include <gensio/gensio.h>
void gensio_set_read_callback_enable(struct gensio *io,
bool enabled);
void gensio_set_write_callback_enable(struct gensio *io,
bool enabled);
so you include the header, you hand it a struct gensio *io, and you tell it enabled β true or false, on or off, slay or not slay. π
π¦ DESCRIPTION π¦
so these functions enable the write callback, or the read callback, for gensios β and lowkey for all child gensios too. the whole family gets the memo, no cap. π«Ά
generally, disabling the read callback will disable all callbacks except write, becauseβ¦ babe, it won't receive any data to do any processing with. no data in, no processing out. it's just math π
here's the situation after you open a gensio or receive a gensio from an accepter: all the enables are set to false. everything. off. blank slate, fresh face, no callbacks. β¨
and what you <em>generally</em> wanna do is enable the read callback and leave it enabled as much as possible, so that all that low-level processing actually happens on the gensio. it's the "keep your phone on silent but never off" of Unix, iykyk. π±
β οΈ real talk though: disabling read on a UDP gensio will disable all read and accept processing. so likeβ¦ don't do that unless you mean it. π
now for the write side. enabling the write callback lets the callback tell you if the gensio can currently write any data. normally you wanna leave this disabled and only enable it if you write data and get a partial write. or β even better, and this is the iconique move β when you have data to write, enable the write callback and write the data from the callback, then disable it when it's all written. clean, tidy, no mess. we love a structured queen π
okay but here's the part nobody tells you: disabling the write callback does not necessarily keep data from being transmitted by the gensio. the SSL gensio, for instance, may transmit key information on a rekey, and other gensios may transmit flow-control information. so likeβ¦ this only affects the write callback. that's the whole scope. periodt. π
and finally, the chaotic bit: disabling the callbacks may not be immediate. and honestly, "immediate" is hard to define in a SMP system anyway β time is fake, threads are fake, everything is vibes. π there may be callbacks running or about to be called when you disable the callback, and they may still run. so you must be prepared to handle these race conditions. no skipping this part bestie, i'm serious. π
π RETURN VALUES π
Zero is returned on success, or a gensio error on failure.
that's it. zero = we ate. error = we did not. π₯
π SEE ALSO π
go read those too, they're part of the lore π§
and that's the whole page, bestie!! π this gem was cooked up on 27 Feb 2019 and lives in the Library Functions Manual as gensio_set...back_enable(3). now go enable those callbacks and handle your race conditions like the icon you are. slay, and remember: zero on success β¨ ππ¦πΈ
π¦ 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