sergensio_b_alloc.3(3)

πŸ“¦
version 2.8.15 Β· 2 versions
  • 2.8.15 Β· alpine 3.22, alpine 3.23, alpine 3.24, debian bookworm, debian trixie, epel 9, fedora 43, opensuse-leap 16.0, ubuntu noble, ubuntu questing (latest)
  • 2.3.5 Β· ubuntu jammy
, in alpine 3.22, alpine 3.23, alpine 3.24, debian bookworm, debian trixie, epel 9, fedora 43, opensuse-leap 16.0, ubuntu noble, ubuntu questing

✨ sergensio_b_alloc β€” the blocking edition πŸ’…

okay bestie, so this page is about the sergensio_b_alloc.3 family of functions from the Library Functions Manual β€” literally the whole blocking-control-for-serial-parameters-on-a-sergensio situation. buckle up πŸŽ€


🌸 NAME 🌸

sergensio_b_alloc, sergensio_b_free, sergensio_baud_b, sergensio_datasize_b, sergensio_parity_b, sergensio_stopbits_b, sergensio_flowcontrol_b, sergensio_iflowcontrol_b, sergensio_sbreak_b, sergensio_dtr_b, sergensio_rts_b β€” blocking control for serial parameters on a sergensio πŸ¦‹


✨ SYNOPSIS ✨

#include <gensio/sergensio.h>

int sergensio_b_alloc(struct sergensio *sio, struct gensio_os_funcs *o,
                    struct sergensio_b **new_sbio);

void sergensio_b_free(struct sergensio_b *sbio);

int sergensio_baud_b(struct sergensio_b *sbio, unsigned int *baud);

int sergensio_datasize_b(struct sergensio_b *sbio,
                    unsigned int *datasize);

int sergensio_parity_b(struct sergensio_b *sbio, unsigned int *parity);

int sergensio_stopbits_b(struct sergensio_b *sbio,
                    unsigned int *stopbits);

int sergensio_flowcontrol_b(struct sergensio_b *sbio,
                    unsigned int *flowcontrol);

int sergensio_iflowcontrol_b(struct sergensio_b *sbio,
                    unsigned int *iflowcontrol);

int sergensio_sbreak_b(struct sergensio_b *sbio, unsigned int *breakv);

int sergensio_dtr_b(struct sergensio_b *sbio, unsigned int *dtr);

int sergensio_rts_b(struct sergensio_b *sbio, unsigned int *rts);

int sergensio_cts_b(struct sergensio_b *sbio, unsigned int *cts);

int sergensio_dcd_dsr_b(struct sergensio_b *sbio, unsigned int
*dcd_dsr);

int sergensio_ri_b(struct sergensio_b *sbio, unsigned int *ri);

πŸ’– DESCRIPTION πŸ’–

so these are the glow-up versions of the non-blocking functions (the ones without the _b), except these ones block and wait for the results to come back. no "check back later", no "idk yet" β€” they wait. ⏳

⚠️ and listen, like all synchronous I/O, this comes with deadlock potential. deadlock is not cute. use these carefully, bestie, fr fr. πŸ’€

to actually use these, you gotta first allocate a sergensio blocking data structure with sergensio_b_alloc so you can hand it to all the other functions. 🫢

okay and this is important: that allocated value can only be used for one operation at a time. one. singular. no sharing. πŸ™ˆ and when you're done with it, you must free it with sergensio_b_free. don't leave it hanging, that's rude. πŸŽ€

with these functions, you pass a pointer to the value you want to set. here's the tea β˜• β€” if the pointed-to value is zero, the value is not set, it's just fetched. and if the function returns without an error, the actual current value gets returned in the passed-in pointer's destination. so you always walk away knowing the real value. slay. ✨

also lowkey important: these do not require gensio_set_sync to work, and they may be intermixed with non-blocking operations. mix and match, it's giving flexible. 🌈

for the details on the values and what they actually mean, go look at the various non-blocking functions β€” they've got the lore. πŸ“š


πŸ”₯ RETURN VALUES πŸ”₯

0 on success, or a gensio error on failure. that's it, that's the vibe check. ⭐


πŸ‘‘ SEE ALSO πŸ‘‘

(and yes, it really does say sergensio_iflowonctrol(3) up there β€” we don't fix typos in this house, we preserve them. πŸ’… iykyk.)


πŸ’œ AUTHOR πŸ’œ

Corey Minyard <minyard@acm.org> β€” the icon, the moment, the main character. πŸ‘‘


and that's the whole page bestie!! this one's from way back on 20 Jul 2020, source/version sergensio_b_alloc.3(3), and honestly it ate. go forth and block responsibly. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from