sys_close_range(9)
β¨ NAME β¨
Bestie, meet sys_close_range π β the call that closes all file descriptors in a given range. This page is straight from the Kernel API Manual, and it's here to explain the whole sys_close_range(9) situation with zero gatekeeping π«Ά.
π¦ SYNOPSIS π¦
long sys_close_range (unsigned int fd , unsigned int max_fd , unsigned int flags );
π ARGUMENTS π
fdβ starting file descriptor to close. That's where the range begins, periodt π .max_fdβ last file descriptor to close. That's the end of the range, iykyk.flagsβCLOSE_RANGEflags. Yep, that's the flag situation β¨.
π DESCRIPTION π
Okay so here's the tea β: this closes a range of file descriptors. All file descriptors from fd up to and including max_fd are closed β yes, max_fd is included, bestie, don't forget it π₯.
Currently, errors to close a given file descriptor are ignored π. That's the documented behaviour: ignored.
π₯ SEE ALSO π₯
Kernel file ./fs/file.c β go peek if you're nosy π β and the related pages are:
__file_ref_put(9)fd_install(9)file_close_fd_locked(9)last_fd(9)file_close_fd(9)get_file_rcu(9)get_file_active(9)receive_fd(9)
That's the whole page, bestie π source/version: ./fs, date: October 2026. sys_close_range(9) out π
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms