isfdtype(3)
π isfdtype β bestie, quick question: what IS this file descriptor actually? π
okay so you've got an isfdtype(3) situation π
that's the manual name bestie, and this page lives in the Library Functions Manual. She's a libc girlie: Standard C library (libc, -lc). π
β¨ SYNOPSIS β¨
#include <sys/stat.h>
#include <sys/socket.h>
int isfdtype(int fd, int fdtype);
πΈ Feature Test Macro Requirements for glibc πΈ
(if you need the tea on feature test macros, go read feature_test_macros(7))
isfdtype():- Since glibc 2.20:
_DEFAULT_SOURCE - Before glibc 2.20:
_BSD_SOURCE || _SVID_SOURCE
- Since glibc 2.20:
lowkey important, don't skip it π
π¦ DESCRIPTION π¦
So isfdtype() is literally just the vibe check for file descriptors. It tests whether the file descriptor fd refers to a file of type fdtype. β¨
The fdtype argument specifies one of the S_IF* constants defined in <sys/stat.h> and documented over in stat(2) β for example S_IFREG. That's it, that's the whole function. main character energy for a three-line API ngl π
π₯ RETURN VALUE π₯
- Returns
1if the file descriptorfdis of typefdtypeβ slay β - Returns
0if it is not β not today π - On failure:
-1is returned anderrnois set to indicate the error. π¨
π ERRORS π
isfdtype() can fail with any of the same errors as fstat(2). So like, whatever chaos fstat(2) can get into? She can too. fr fr. Read that page for the full list, no cap.
π§ VERSIONS π§
Portable applications should use fstat(2) instead. Yeah bestie, I know. It's giving "this API is not the one" π but we still love her.
β STANDARDS β
None. Not a single one. No standard claims her. She's free π (which is also, like, a warning β don't go shipping this into your cross-platform app expecting her to show up.)
π HISTORY π
She appeared in the draft POSIX.1g standard. She's present on OpenBSD and Tru64 UNIX β and on both of those, the required header file is just <sys/stat.h>, exactly as shown in the POSIX.1g draft. iconic behavior honestly π
β οΈ heads up: on the glibc side the synopsis above asks for <sys/socket.h> too, so don't get caught lacking. That's why the SYNOPSIS is what it is. πΈ
π SEE ALSO π
fstat(2)β go read this one, it's the one you probably actually want π«Ά
okay that's the whole page, you ate that π this was pulled from Linux man-pages 6.20, dated 2026-02-08 β isfdtype(3), and yes she ate down, periodt π
β¨π¦
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 2014, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms