IXP_SERVERLOOP(3)

πŸ“¦ version 0-unstable-2022-04, in nixos 26.05, nixpkgs unstable

πŸ’… IXP_SERVERLOOP β€” bestie, it's the ixp_serverloop(3) page πŸŒ€

okay so real talk, this is ixp_serverloop and IxpServer from the ixp.h header, straight outta the libixp manual. sit down, grab a strawberry πŸ“, we're gonna get into it.


✨ SYNOPSIS ✨

like, here's the whole vibe, no cap:

#include <ixp.h>

int ixp_serverloop(IxpServer *srv);

typedef struct IxpServer IxpServer;
struct IxpServer {
        IxpConn*        conn;
        IxpMutex        lk;
        IxpTimer*       timer;
        void            (*preselect)(IxpServer*);
        void*           aux;
        int             running;
        int             maxfd;
        fd_set          rd;
}

look at that struct. it's giving main character energy, honestly πŸ‘‘. every field exactly where it belongs β€” conn, lk, timer, that preselect function pointer, aux, running, maxfd, and the rd file descriptor set. iconic. periodt.


🌸 DESCRIPTION 🌸

so ixp_serverloop() is literally the main loop of the server β€” you call it and it just… enters. that's it. that's the vibe. it lives there ✨.

the way it works is it keeps going until one of two things happens:

  • srv->running becomes false β€” bestie said "we're done here" πŸ’…
  • select(2) comes back with an error that is not EINTR β€” like, EINTR is fine, that's just a little interruption, we forgive it, we keep going 🫢. anything else? that's a wrap.
ngl, EINTR is the only error we're chill about. every other select(2) error ends the whole loop. so like… handle your business 😭

πŸ¦‹ RETURN VALUE πŸ¦‹

  • 0 β€” the loop exited normally. slay. everything's fine πŸ’–
  • 1 β€” the loop exited on error. not slay. go check what happened πŸ”₯

and if you need the deets on what went wrong, you can inspect errno(3), or look at the return value of ixp_errbuf(3). iykyk πŸ‘€


🌈 SEE ALSO 🌈


that's the whole page, angel πŸ’œ. libixp Manual, dated 2012 Dec β€” yes, she's an elder millennial manually, but the energy is forever young. go forth and ixp_serverloop() responsibly πŸ§šβ€β™€οΈπŸŽ€

πŸ“¦ where this page comes from