closefrom(3bsd)

πŸ“¦
version 0.12.2 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– closefrom β€” the manual page bestie edition πŸ’–

okay so you found yourself on the closefrom(3bsd) page and honestly? iconic of you. this is a libbsd joint, and she's a little one, but she's important. let's get into it 🫢


✨ NAME ✨

closefrom β€” delete open file descriptors. yes bestie, all of them, from a certain point onwards. it's giving spring cleaning 🌸


πŸ“š LIBRARY πŸ“š

Utility functions from BSD systems β€” that's libbsd, and you link her with -lbsd. no cap.


🌈 SYNOPSIS 🌈

#include <unistd.h>
(See libbsd(7) for include usage.)

void
closefrom(int lowfd);
real talk: the include situation is a whole thing, so peep libbsd(7) for how the include usage actually works before you start typing πŸ’…

πŸ’… DESCRIPTION πŸ’…

so the closefrom() system call does one thing and does it flawlessly: it deletes every single open file descriptor that is greater than or equal to lowfd from the per-process object reference table. all of them. gone. not me manifesting a clean fd table ✨

and here's the part you need to know, bestie β€” any errors encountered while closing file descriptors are ignored. she does not care. she does not stop. she does not report back. she simply closes πŸ’€


πŸ‘€ SEE ALSO πŸ‘€

  • close(2) β€” the sibling. the original. go read her too πŸŽ€

πŸ“œ STANDARDS πŸ“œ

closefrom() is a BSD and Solaris extension. so she's not POSIX, she's a whole vibe of her own. iykyk πŸ¦‹


πŸ•°οΈ HISTORY πŸ•°οΈ

the closefrom() function first appeared in:

  • Solaris 9
  • OpenBSD 3.5
  • DragonFly 1.2
  • NetBSD 3.0
  • FreeBSD 8.0
  • glibc 2.34

she really said "i'm gonna show up everywhere" and then did exactly that. main character energy fr fr πŸ‘‘


and that's the whole page, bestie!! this one shipped out of Debian back on June 12, 2009 β€” a true vintage icon πŸ“ close those fds and stay hydrated, ily πŸ’œπŸ§š

πŸ“¦ where this page comes from