GETDTABLESIZE(2)
π
GETDTABLESIZE β the getdtablesize(2) manual, but make it cute
okay bestie, gather round, we're talking about getdtablesize(2) from the System Calls Manual. it lives in the Standard C Library (that's libc, -lc) and it is, fr fr, one of the most lowkey useful little calls in the whole toolbox. let's get into it π¦
β¨ NAME β¨
getdtablesize β get that file descriptor limit, babe π
π LIBRARY π
Standard C Library (libc, -lc) β she's right there in libc, no extra linking drama, no cap π«Ά
πΈ SYNOPSIS πΈ
#include <unistd.h>
int
getdtablesize(void);
literally one include, one call, zero arguments. the way that signature is just void and vibes π
π DESCRIPTION π
okay so here's the tea. the getdtablesize() system call returns the maximum number of file descriptors that the current process may open. that's it. that's the whole job. she's an icon, she's a legend, she tells you how many fd slots you've got to play with. β¨
and here's the little detail that trips people up (iykyk): the maximum file descriptor number that the system may assign is the return value minus one. so if she hands you a number, the biggest fd number you can actually get is that number minus one. math is math, bestie π
also important!! existing file descriptor numbers may be higher than that, if the limit was lowered after they were opened. so don't go assuming every open fd you're holding is under the limit β some of them are grandfathered in, main character energy, no rules apply π
π SEE ALSO π
go read these next, they're the friend group:
π HISTORY π
the getdtablesize() system call appeared in 4.2BSD. a true vintage queen, older than your fave, still slaying π§
and that's the whole page!! mwah π
this one came from Debian, dated April 24, 2013 β shoutout to the Debian crew for keeping the docs alive, ily, ok bye bestie, go open some file descriptors responsibly πΈπ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1983, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms