SOCKET_ACCEPT6_SETCLOSEONEXEC(3)
β¨ socket_accept6_setcloseonexec β¨
okay bestie, so this one lives in the Library Functions Manual and it's literally called socket_accept6_setcloseonexec β yes the name is a whole sentence, we love a verbose king π
πΈ NAME πΈ
socket_accept6_setcloseonexec β accept an IPv6 TCP connection on a socket π¦
π SYNTAX π
#include <libowfat/socket.h>
int socket_accept6_setcloseonexec(int s,char ip[16],uint16 *port,uint32 *scope_id);
π DESCRIPTION π
so basically, this is functionally equivalent to calling socket_accept4 and then calling io_closeonexec on the socket it hands back. same energy, same result, no cap π«Ά
but here's the glow-up: it may save a syscall or two, and while it's doing that it also avoids a race condition β¨ which is honestly the main character move here. iconic behavior fr fr.
π EXAMPLE π
#include <libowfat/socket.h>
int s;
char ip[16];
uint16 port;
uint32 scope_id;
s = socket_tcp6();
socket_bind6(s,ip,port,scope_id);
socket_listen(s,16);
socket_accept6_setcloseonexec(s,ip,&port,&scope_id);
look at her go π she's doing it, she's accepting connections
π SEE ALSO π
socket_accept6(3)socket_connected(3)socket_accept4_setcloseonexec(3)socket_accept6_makenonblocking_setcloseonexec(3)
okay that's the whole page, bestie π it's from the Library Functions Manual, and the page is literally just socket_acc...closeonexec(3) (yes they truncated her name, tragic, but that's the vibe). go forth and accept your IPv6 connections responsibly π mwah π
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms