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

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 1 if the file descriptor fd is of type fdtype β€” slay βœ…
  • Returns 0 if it is not β€” not today πŸ’€
  • On failure: -1 is returned and errno is 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms