io_passfd(3)
π io_passfd(3) β bestie edition
ok so this is a page from the Library Functions Manual, and the star of the show is io_passfd(3). pull up a chair π«Ά
β¨ NAME β¨
io_passfd β slide a whole file descriptor across a Unix Domain socket like it's a note in class π
πΈ SYNTAX πΈ
#include <libowfat/io.h>
int io_passfd(int64 sock,int64 fd);
π¦ DESCRIPTION π¦
okay bestie, listen. io_passfd transfers the file descriptor fd over the Unix Domain socket sock. that's the whole vibe. π₯
and likeβ¦ it works much like dup(2), except the plot twist is that the copy of the descriptor does not show up in this process. nope. it appears at the other end of the Unix Domain socket instead. which means that other end has to be a process on the same system. no long-distance relationships here, sorry π
the peer over there can then use io_receivefd(3) to receive the file descriptor. iconic teamwork, no cap. π
β οΈ important bestie note: the passed descriptor stays open in the sending process. it does not get closed on your end. so don't be out here acting surprised when it's still hanging around, okay? π
π RETURN VALUE π
io_passfdreturns0on success π-1on error, and it setserrnoaccordingly π
that's it, that's the whole deal.
π SEE ALSO π
io_receivefd(3)β the other half of the friendship, the one who catches what you threw π
made with love, from the Library Functions Manual, page io_passfd(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