SOCKET_ACCEPT4_MAKENONBLOCKING_SETCLOSEONEXEC(3)

πŸ“¦
version 0.34 Β· 2 versions
, in alpine 3.24, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

okay so bestie, welcome to the socket_acc...closeonexec(3) page from the Library Functions Manual β€” yes, the title is literally abbreviated like that 😭 β€” and the main-character function is socket_accept4_makenonblocking_setcloseonexec. Say it three times fast, I dare you πŸ’…

πŸŽ€ NAME πŸŽ€

  • socket_accept4_makenonblocking_setcloseonexec β€” accept an IPv4 TCP connection on a socket and set it to non-blocking I/O and close-on-exec.

✨ SYNOPSIS ✨

#include <libowfat/socket.h>

int socket_accept4_makenonblocking_setcloseonexec(int s,char
ip[4],uint16 *port);

πŸ’– DESCRIPTION πŸ’–

This one is functionally equivalent to calling socket_accept4 and then calling ndelay_on and io_tcloseonexec on the returned socket. That’s the whole vibe, fr fr.

The page literally says: β€œHowever, if may save a syscall or two and in the process avoid a race condition.” Yes, β€œif may” is right there in the original β€” we are not gaslighting you πŸ’€. The meaning is that it may save a syscall or two and in the process avoid a race condition. Iconic efficiency, no cap ✨

🌸 EXAMPLE 🌸

#include <libowfat/socket.h>

int s;
char ip[4];
uint16 p;

s = socket_tcp4();
socket_bind4(s,ip,p);
socket_listen(s,16);
socket_accept4_makenonblocking_setcloseonexec(s,ip,&p);

πŸ¦‹ SEE ALSO πŸ¦‹

Go be nosy, bestie:


Cute sign-off πŸ’–: the footer’s source/version/date situation is just the repeated socket_acc...closeonexec(3) β€” no actual date is printed here β€” so bye bestie, go accept some connections and slay 🌈πŸ’