io_receivefd(3)
io_receivefd π
okay bestie, so this one's from the Library Functions Manual β yes we're reading man pages for fun now, it's giving study date energy π
β¨ NAME β¨
io_receivefd β receive a file descriptor over a Unix Domain socket π«Ά
like, somebody slid a whole fd into your DMs. except the DMs are a Unix Domain socket. iykyk.
πΈ SYNTAX πΈ
#include <libowfat/io.h>
int64 io_receivefd(int64 sock);
π DESCRIPTION π
so io_receivefd receives a file descriptor from the Unix Domain socket called sock. the way that a file descriptor can just... travel through a socket... iconic behavior honestly π
and if you wanna be the one doing the sending? that's a whole other function, bestie β you send a descriptor using io_passfd(3). it's giving pen pals. it's giving "here, hold this fd for me" π¦
heads up:io_receivefdreturns-1on error, or the file descriptor if it worked. that's the whole vibe check β-1means we're in our flop era, anything else is your new fd β¨
okay and now the messy part π the underlying Unix API is lowkey extra and can send more than one descriptor at the time. this function? it expects only one descriptor. so if more than one got sent, it will return the first one and just... not address the rest. no cap, that's the behavior. so don't come crying to me about the other fds, they're still in the socket's inbox π
π SEE ALSO π
io_passfd(3)β the sender half of this situationship π
that's the whole page, bestie!! go forth and receive your file descriptors responsibly π
β from the Library Functions Manual, filed under io_receivefd(3), mwah π
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· 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 noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- 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