gensio_acc_accept_s(3)

πŸ“¦
version 3.0.4 Β· 2 versions
  • 3.0.4 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian bookworm, debian trixie, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 2.3.5 Β· ubuntu jammy
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian bookworm, debian trixie, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– gensio_acc_accept_s β€” the synchronous accepter glow-up πŸ’–

okay bestie, so this is one of the Library Functions Manual pages, and it's all about doing accepter stuff synchronously instead of the usual callback chaos. no cap, it's short but it's important, so let's get into it 🫢


✨ NAME ✨

gensio_acc_set_sync, gensio_acc_accept_s, gensio_acc_accept_s_intr β€” the trio that does Synchronous I/O operations on a gensio accepter πŸ’…


🌸 SYNOPSIS 🌸

#include <gensio/gensio.h>

int gensio_acc_set_sync(struct gensio_accepter *acc);

int gensio_acc_accept_s(struct gensio_accepter *acc,
                    struct gensio_time *timeout,
                    struct gensio **new_io);

int gensio_acc_accept_s_intr(struct gensio_accepter *acc,
                    struct gensio_time *timeout,
                    struct gensio **new_io);

like yes, that's the whole vibe up there ⭐


πŸ¦‹ DESCRIPTION πŸ¦‹

so normally, a gensio accepter is asynchronous callback based. and honestly? that serves most programs very well, especially the ones that need to juggle multiple accepts on the same accepter or on different accepters. main character energy, truly πŸ‘‘

but every once in a while you need to do something synchronous with the program execution. lowkey the most common case is when you've got a simple little program that just accepts one connection and then does a thing. no callbacks, no drama, just vibes.

gensio_acc_set_sync β€” flip the switch πŸ”₯

gensio_acc_set_sync sets up the gensio accepter for synchronous accepts.

and here's the part you need to hear, bestie:

  • once you do this, the event callback that is currently registered will no longer receive new connection events.
  • it *will* still receive other callbacks though. so don't ghost it entirely πŸ™ˆ
  • you must call this before starting up the gensio accepter.
  • and once you call it, the gensio accepter is in sync mode until you shut it down. no take-backsies, periodt.

gensio_acc_accept_s β€” the waiting game 🌈

gensio_acc_accept_s waits for an incoming connection on the gensio accepter.

  • it waits for the amount of time in timeout
  • timeout gets updated to the amount of time left to wait
  • if timeout is NULL, it waits forever 😭 (yes, forever forever)
  • if no error is returned, the new incoming connection comes back to you in new_io πŸ’–

gensio_acc_accept_s_intr β€” the interruptible twin 🧚

gensio_acc_accept_s_intr is like gensio_acc_accept_s, but it returns immediately if a signal interrupt occurs.

on systems without signals, this is the same as gensio_acc_accept_s. iykyk.

πŸ’œ RETURN VALUES πŸ’œ

  • Zero is returned on success πŸŽ€
  • or a gensio error on failure πŸ’€

that's it. that's the whole return value situation.


πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, bestie, they're part of the lore 🌟


and that's the page!! this lil gem is from the gensio_acc_accept_s(3) manual, source/version vibes dated 27 Jan 2020 β€” iconic, historic, a moment in time πŸ’…βœ¨ slay, go accept some connections fr fr πŸ¦‹

πŸ“¦ where this page comes from