Scroll to navigation

sergensio_b_alloc.3(3) Library Functions Manual sergensio_b_alloc.3(3)


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


#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);


These are equvalent to the non-blocking functions (without the _b), but block waiting for the results. Like all synchronous I/O, this can come with deadlock potential, so these should be used carefully.

To use these, you must first allocate a sergensio blocking data structure using sergensio_b_alloc for use in the other functions. This allocated value can only be used for one operation at a time. When you are done with it, you must free it with sergensio_b_free.

With these function, you pass a pointer to the value you want to set. If the pointed to value is zero, the value is not set, just fetched. If the function returns without an error, the actual current value is returned in the passed-in pointer's destination.

Note that these do not require gensio_set_sync to work, and may be intermixed with non-blocking operations.

See the various non-blocking functions for detail on the values and what they mean.


Zero is returned on success, or a gensio error on failure.


sergensio(5), sergensio_baud(3), sergensio_datasize(3), sergensio_parity(3), sergensio_stopbits(3), sergensio_flowcontrol(3), sergensio_iflowonctrol(3), sergensio_sbreak(3), sergensio_dtr(3), sergensio_rts(3)


Corey Minyard <>
20 Jul 2020