# 文件描述符

**文件描述符**（file descriptor）是一个小的非负整数，为进程私有，用于索引该进程的打开文件表，并被 read、write、fcntl 等系统调用用来代替路径。当程序调用 open() 时，内核创建一个指向某文件的打开文件描述，以及一个指向该打开文件描述的文件描述符；其他 I/O 函数正是用这个描述符来指代该文件。<sup>[1](https://pubs.opengroup.org/onlinepubs/9690949499/functions/open.html)</sup> 这种整数索引的设计覆盖的不只是普通文件：管道和套接字同样以描述符的形式出现。<sup>[2](https://www.daemon-systems.org/man/file.9.html)</sup>

| 关键事实 | 细节 |
|---|---|
| 定义 | 一个小的非负整数，索引进程的打开文件描述符表，由 open() 返回，供 read(2)、write(2)、lseek(2) 和 fcntl(2) 使用<sup>[3](https://man.archlinux.org/man/open.2.en)</sup> |
| 三层模型 | 每进程描述符表 → 系统级打开文件描述（状态标志、偏移位置） → 共享的 inode/vnode<sup>[1](https://pubs.opengroup.org/onlinepubs/9690949499/functions/open.html)</sup><sup> • </sup><sup>[4](https://www.socratopia.app/library/operating-systems-en/chapter-23)</sup> |
| 标准描述符 | 0、1、2 一般指标准输入、标准输出和标准错误；3 及以上没有预定义含义<sup>[5](https://web.stanford.edu/class/archive/cs/cs110/cs110.1206/lectures/04-filesystem-structures-slides.pdf)</sup> |
| Linux 默认值 | 内核给用户空间的 RLIMIT_NOFILE 为软限制 1024 / 硬限制 4096；systemd 自 v240 起给服务设为软限制 1024 / 硬限制 524,288<sup>[6](https://0pointer.net/blog/file-descriptor-limits.html)</sup> |
| 系统级上限 | fs.nr_open 默认为 1,048,576，并限制 RLIMIT_NOFILE 的上限；在 x86_64 上其最大值为 2,147,483,584；fs.file-max 超限时返回 ENFILE<sup>[7](https://man7.org/linux/man-pages/man5/proc_sys_fs.5.html)</sup><sup> • </sup><sup>[8](https://access.redhat.com/solutions/1479623)</sup> |
| select 约束 | 在 glibc 的 Linux 上，select() 只能处理 0 到 1023 号描述符（FD_SETSIZE − 1）<sup>[6](https://0pointer.net/blog/file-descriptor-limits.html)</sup> |
| 耗尽代价 | 某缩略图服务在大促期间越过 1,024 的软限制，在 CPU 和内存尚未吃紧时就因 EMFILE 失败，最终通过修复泄漏并把 LimitNOFILE 设为 65,536 解决<sup>[9](https://hibug.me/linux-too-many-open-files-systemd-limitnofile)</sup> |

## 定义与三层模型

打开一个文件会创建三层状态，而非一层。<sup>[4](https://www.socratopia.app/library/operating-systems-en/chapter-23)</sup> 第一层是每进程描述符表：open() 返回“一个小的非负整数，作为进程打开文件描述符表中某一项的下标。”<sup>[3](https://man.archlinux.org/man/open.2.en)</sup> 第二层是打开文件描述，这是一个系统级的内核抽象，保存文件打开状态标志和文件位置。<sup>[10](https://biriukov.dev/docs/fd-pipe-session-terminal/1-file-descriptor-and-open-file-description/)</sup> POSIX 将 open() 定义为恰好创建这样一对东西：一个指向文件的打开文件描述，以及一个指向该描述的文件描述符。<sup>[1](https://pubs.opengroup.org/onlinepubs/9690949499/functions/open.html)</sup> 第三层是内存中的 inode，或称 vnode，由同一文件的所有描述共享。

分层的目的是把 inode 与文件对象解耦，使同一文件能以不同标志（如 O_DIRECT、O_SYNC、O_APPEND）被多次打开，并拥有各自独立的偏移。<sup>[10](https://biriukov.dev/docs/fd-pipe-session-terminal/1-file-descriptor-and-open-file-description/)</sup> Solaris 的实现把这种拆分明确表示出来：文件描述符是从 open()、fcntl()、pipe() 或 dup() 返回的非负整数，索引一个每进程的 uf_entry_t 结构数组；每个文件表项保存进程相关的数据，包括当前寻址偏移，并引用一个系统级的 vnode，后者保存文件类型、大小和所在文件系统。<sup>[11](https://home.mit.bme.hu/~meszaros/edu/oprendszerek/segedlet/unix/4_fajlrendszerek/solaris_internals_ch14_file_system_framework.pdf)</sup>

术语是常见的马虎之源。文献中“文件描述符”既指那个整数，也松散地指它所指向的打开文件描述；POSIX 规范将两者区分开，这个区分很重要，因为两个描述符可以指向同一个描述（dup），两个描述也可以指向同一个 inode（两次独立打开）。<sup>[1](https://pubs.opengroup.org/onlinepubs/9690949499/functions/open.html)</sup><sup> • </sup><sup>[4](https://www.socratopia.app/library/operating-systems-en/chapter-23)</sup> 在 [Linux 内核](https://www.edgepedia.org/zh/linux-kernel)中，描述符表本身用基于 RCU 的无锁模型管理：fd 集合、文件指针数组和大小都放在一个单独的 struct fdtable 中，扩容时分配新的 fdtable 并通过 RCU 释放，使无锁读者能看到一致的状态。<sup>[12](https://docs.kernel.org/filesystems/files.html)</sup>

## 生命周期：打开、复制、继承、关闭

描述符由 open() 以及 pipe()、dup() 等以描述符为后端的对象构造函数创建，每个都返回一个索引进程表的非负整数。<sup>[11](https://home.mit.bme.hu/~meszaros/edu/oprendszerek/segedlet/unix/4_fajlrendszerek/solaris_internals_ch14_file_system_framework.pdf)</sup> 随后有三种操作塑造其生命周期。

**复制。** dup()、dup2()、dup3() 以及带 F_DUPFD 的 fcntl() 在进程 fd 表中为系统级打开文件描述表中的已有项创建新引用，因此这些别名共享一个寻址位置；shell 的输出重定向就是这样实现的。<sup>[4](https://www.socratopia.app/library/operating-systems-en/chapter-23)</sup><sup> • </sup><sup>[10](https://biriukov.dev/docs/fd-pipe-session-terminal/1-file-descriptor-and-open-file-description/)</sup>

**继承。** fork() 把父进程的 fd 表复制到子进程，表项指向同一批系统级打开文件项而非副本，因此父子进程共享文件位置和状态标志。<sup>[4](https://www.socratopia.app/library/operating-systems-en/chapter-23)</sup><sup> • </sup><sup>[10](https://biriukov.dev/docs/fd-pipe-session-terminal/1-file-descriptor-and-open-file-description/)</sup> 教科书式的讲解归纳出三种共享模式：独立打开只共享 inode；fork 共享打开文件项和寻址指针；dup 在单个进程内创建别名。<sup>[4](https://www.socratopia.app/library/operating-systems-en/chapter-23)</sup> BSD 内核描述的是同一设计：描述符表从父进程继承，因此多个进程可以引用同一个文件项，后者带有引用计数 f_count，降为零时被释放。<sup>[2](https://www.daemon-systems.org/man/file.9.html)</sup>

**执行时关闭。** 通过打开时的 O_CLOEXEC 或事后的 fcntl 标记为执行时关闭（close-on-exec）的描述符，会在 exec 期间被内核自动关闭；忘记这一点被称为经典的安全缺陷，因为一个特权父进程 exec 子进程时，否则会把所有打开的描述符都交给子进程，包括指向敏感文件的描述符。<sup>[4](https://www.socratopia.app/library/operating-systems-en/chapter-23)</sup> 这个标志之所以存在，是因为库会背着主程序打开文件，手动追踪并不可靠；在 Linux 5.9 之前，exec 前关闭描述符需要遍历直到 RLIMIT_NOFILE 边界的所有可能 fd。<sup>[10](https://biriukov.dev/docs/fd-pipe-session-terminal/1-file-descriptor-and-open-file-description/)</sup> 一个微妙之处：dup() 和 dup2() 会清除新建描述符上的执行时关闭标志，因此必须重新标记。<sup>[10](https://biriukov.dev/docs/fd-pipe-session-terminal/1-file-descriptor-and-open-file-description/)</sup>

## 标准描述符 0、1、2

每个进程维护自己的一套描述符，描述符 0、1、2 一般指标准输入、标准输出和标准错误；3 及以上没有预定义含义。<sup>[5](https://web.stanford.edu/class/archive/cs/cs110/cs110.1206/lectures/04-filesystem-structures-slides.pdf)</sup> 描述符 0、1、2 最常绑定到终端。<sup>[5](https://web.stanford.edu/class/archive/cs/cs110/cs110.1206/lectures/04-filesystem-structures-slides.pdf)</sup>

## 限制与资源核算

Linux 在三个层面实施描述符限制。每进程层面，RLIMIT_NOFILE 有软限制（程序触发 EMFILE 的值）和硬限制（非特权程序可将软限制提升到的值）。Linux 内核首次调用用户空间时，将 RLIMIT_NOFILE 设为软限制 1024、硬限制 4096。<sup>[6](https://0pointer.net/blog/file-descriptor-limits.html)</sup> 内核文档另有一处说明，进程可分配文件句柄最大数的每进程默认值为 1024*1024（1048576），实际限制取决于 RLIMIT_NOFILE。<sup>[13](https://docs.kernel.org/6.12/admin-guide/sysctl/fs.html)</sup> 这两段话说的不是一回事：一个是初始用户空间限制，一个是 sysctl 层面的默认值。

每进程限制之上是 fs.nr_open，自 Linux 2.6.25 起，它对 RLIMIT_NOFILE 可提升到的值施加天花板；其默认为 1,048,576，对非特权和特权进程都强制执行。<sup>[7](https://man7.org/linux/man-pages/man5/proc_sys_fs.5.html)</sup> 它的最大值受 sysctl_nr_open_max 约束，在 x86_64 上为 2,147,483,584。<sup>[8](https://access.redhat.com/solutions/1479623)</sup> 再往上，/proc/sys/fs/file-max 定义所有进程打开文件数的系统级限制，因该限制失败的系统调用返回 ENFILE，与每进程的 EMFILE 是不同错误。<sup>[7](https://man7.org/linux/man-pages/man5/proc_sys_fs.5.html)</sup> 内核文档建议，当出现文件句柄耗尽的错误消息时调高 file-max。<sup>[13](https://docs.kernel.org/6.12/admin-guide/sysctl/fs.html)</sup> 当前用量可从 /proc/sys/fs/file-nr 读取，它报告已分配文件句柄、空闲句柄和最大值；自 Linux 2.6 起内核会释放已回收的句柄，因此空闲值恒为零。<sup>[7](https://man7.org/linux/man-pages/man5/proc_sys_fs.5.html)</sup>

systemd 在现代发行版上改变了局面。自 v240 起，服务的内置默认值为软限制 RLIMIT_NOFILE 1024、硬限制 524,288。<sup>[9](https://hibug.me/linux-too-many-open-files-systemd-limitnofile)</sup> 随附的 system.conf 模板带有注释行 DefaultLimitNOFILE=1024:HIGH_RLIMIT_NOFILE，在源码中确认了 1024 的软限制默认值。<sup>[14](https://fossies.org/linux/systemd/src/core/system.conf.in)</sup> systemd 还会在启动时自动把 file-max 和 nr_open 两个 sysctl 调到最大值，使这些调节参数在此类系统上实际上变得多余。<sup>[6](https://0pointer.net/blog/file-descriptor-limits.html)</sup> 对于 PID 1 自身，systemd 将 RLIMIT_NOFILE 设为内核允许的最高值（从 /proc/sys/fs/nr_open 读取），因为 PID 1 需要的远不止内核默认的 1K；内核不允许 RLIMIT_NOFILE 为“无限制”。<sup>[15](https://github.com/systemd/systemd/issues/9205)</sup>

## 数字阶梯

上述数字构成一架梯子：1024（首次调用用户空间时的软限制，也是 select 兼容性所需），4096（初始硬限制），524,288（systemd 服务硬限制），1,048,576（nr_open 默认值），以及 2,147,483,584（x86_64 上 nr_open 最大值）。<sup>[6](https://0pointer.net/blog/file-descriptor-limits.html)</sup><sup> • </sup><sup>[7](https://man7.org/linux/man-pages/man5/proc_sys_fs.5.html)</sup><sup> • </sup><sup>[8](https://access.redhat.com/solutions/1479623)</sup> 软限制刻意保持在 1024：在 glibc 的 Linux 上，select() 只能处理 0 到 1023（FD_SETSIZE − 1）号描述符，更高的软限制会让基于 select 的程序无法监视某些描述符。<sup>[6](https://0pointer.net/blog/file-descriptor-limits.html)</sup>

等待结构有自己的核算方式。epoll 的 max_user_watches 限制约束每用户的内核内存，在 32 位内核上每个监视项约耗 90 字节，64 位上约耗 160 字节；默认为可用低内存的 4% 除以监视项开销。<sup>[7](https://man7.org/linux/man-pages/man5/proc_sys_fs.5.html)</sup> 一次具体故障展示了这架梯子在实践中的表现：某缩略图服务在大促期间越过 1,024 的软限制，因为每个客户端连接、临时文件和泄漏的套接字都消耗一个描述符，在 CPU 或内存吃紧之前就产生了 EMFILE（“Errno 24”）失败；修复泄漏并把 LimitNOFILE 设为 65,536 后，下一次大促期间打开描述符峰值为 4,100，/thumbs 的 5xx 率保持在 0.05% 以下，四台主机一周内零 Errno 24 记录。<sup>[9](https://hibug.me/linux-too-many-open-files-systemd-limitnofile)</sup> 应用层的核算也发生了变化：在 [PostgreSQL](https://www.edgepedia.org/zh/postgresql) 18 中使用 io_uring 时，postmaster 为每个进程槽的每个环持有一个文件描述符，因此在 max_connections = 300 时它持有 342 个描述符，而在 1024 软限制下把 max_connections 推到 1000 会导致启动失败，报“无法设置 io_uring 队列：打开的文件过多”。<sup>[16](https://thebuild.com/blog/all-your-gucs-in-a-row-max_files_per_process)</sup>

## 等待大量描述符

在 glibc 的 Linux 上，select() 受 FD_SETSIZE 限制，只能处理 0 到 1023 号描述符。<sup>[6](https://0pointer.net/blog/file-descriptor-limits.html)</sup> 提高每进程限制是 C10K 工作（处理一万个并发客户端）有据可查的前提之一：ulimit -n 32768 提高当前进程的限制，在 2.2.x 内核上向 /proc/sys/fs/file-max 写入 32768 可提高系统限制。<sup>[17](https://www.kegel.com/c10k.html)</sup> 有一个语义要点适用于 poll()、select()、epoll 及类似接口：O_NONBLOCK 的设置对它们的运作没有影响，因为“就绪”意味着所请求的 I/O 操作不会阻塞，尽管这类就绪通知可能是虚假的，并不保证操作一定能成功传输数据。<sup>[3](https://man.archlinux.org/man/open.2.en)</sup><sup> • </sup><sup>[28](https://linuxman7.org/linux/man-pages/man2/poll.2.html)</sup>

io_uring 改变了描述符在提交过程中的角色。每个提交队列项携带一个操作码和一个 fd 字段，指明该 I/O 作用于哪个文件描述符。<sup>[18](https://man7.org/linux/man-pages/man7/io%5Furing.7.html)</sup> 使用 IORING_REGISTER_FILES 时，环在环内表中保留内核文件引用，带 IOSQE_FIXED_FILE 的 SQE 把 sqe->fd 解释为注册表下标而非进程文件描述符，从而在请求路径上省去反复的描述符查找。<sup>[19](https://nalar.dev/io-uring-registered-files-bypass-repeated-descriptor-lookup/)</sup> 关闭原进程描述符不会使已注册的文件失效，因为环持有自己的引用；该槽位在替换、注销或随环一起释放之前一直可用。<sup>[19](https://nalar.dev/io-uring-registered-files-bypass-repeated-descriptor-lookup/)</sup> 注册表容量本身是一个明确的限制：即使进程还能分配另一个普通描述符，槽位耗尽也会导致分配失败。<sup>[19](https://nalar.dev/io-uring-registered-files-bypass-repeated-descriptor-lookup/)</sup>

## 与 Windows 句柄及其他内核的比较

Windows 采用不同的模型。进程用 CreateFile 函数打开文件后，得到的文件句柄一直与该文件绑定，直到进程结束或通过 CloseHandle 释放句柄。<sup>[20](https://learn.microsoft.com/en-us/windows/win32/fileio/file-handles)</sup> 每个文件句柄和文件对象通常对每个打开文件的进程都是唯一的，唯一例外是句柄经 DuplicateHandle 复制或被某一子进程继承，此时它们看到的是同一个共享文件对象。<sup>[20](https://learn.microsoft.com/en-us/windows/win32/fileio/file-handles)</sup> 与 Unix 相比有两点显著不同。第一，CreateFile 要求应用程序指定共享模式：读、写、两者或都不；dwShareMode 设为零的已打开文件在其句柄关闭之前无法被任何进程重新打开，称为独占访问。<sup>[21](https://learn.microsoft.com/en-us/windows/win32/fileio/creating-and-opening-files)</sup> 第二，继承是按句柄选择加入的：应用程序启动时，只有当来自启动进程的句柄被创建为可继承时才会继承它们，而 Unix 的 fork 复制整张表。<sup>[21](https://learn.microsoft.com/en-us/windows/win32/fileio/creating-and-opening-files)</sup><sup> • </sup><sup>[4](https://www.socratopia.app/library/operating-systems-en/chapter-23)</sup> Windows 中句柄指向的文件数据是共享的，尽管句柄对进程私有，因此共享同一文件的进程必须同步访问。<sup>[20](https://learn.microsoft.com/en-us/windows/win32/fileio/file-handles)</sup>

BSD 和 Solaris 以不同名称实现与 Linux 相同的三层设计。在 BSD 文件模型中，管道的文件项指向数据传输期间使用的系统块，套接字的项指向进程间通信使用的块，数据文件指向 vnode 结构，展示了一种描述符类型如何覆盖多种对象。<sup>[2](https://www.daemon-systems.org/man/file.9.html)</sup> Solaris 通过 process.max-file-descriptor 实施每进程限制，可用 prctl 查看。<sup>[11](https://home.mit.bme.hu/~meszaros/edu/oprendszerek/segedlet/unix/4_fajlrendszerek/solaris_internals_ch14_file_system_framework.pdf)</sup>

## 近期进展

最活跃的领域是 io_uring 加固。2026 年 1 月的一个补丁集增加了每任务 io_uring 限制，通过 ring_fd == -1 的 IORING_REGISTER_RESTRICTIONS 注册，使任务创建的任何环都继承这些限制；限制跨 fork 继承，子进程只能进一步限制操作，不能放宽。<sup>[22](https://lore.gnuweeb.org/io-uring/20260119235456.1722452-8-axboe@kernel.dk/T/)</sup> 在各类限制中，IORING_RESTRICTION_SQE_FLAGS_ALLOWED 设定允许出现在 io_uring 操作中的操作标志列表。<sup>[23](https://lwn.net/Articles/1054225/)</sup> BPF 限制相关工作在标记为 20260206 的合并中并入 Linux 主线树，增加了施加于被过滤任务所创建环的每任务过滤器，并跨 fork 继承。<sup>[24](https://github.com/torvalds/linux/commit/591beb0e3a03258ef9c01893a5209845799a7c33)</sup> 有了这一支持，BPF 程序可以在队列上取代 io_uring 的正常事件循环，用新的 bpf_io_uring_submit_sqes() kfunc 指示内核处理提交队列项。<sup>[25](https://lwn.net/Articles/1062286/)</sup>

io_uring 内部的描述符处理也在变得更廉价。Linux 7.2 的 io_uring 更新允许已注册缓冲区用于普通 SEND 和 RECV，而不只是零拷贝发送路径，使 ublk 的 NBD 后端之类的目标能够通过普通 TCP 直接向已注册缓冲区传入 I/O 数据或从中传出 I/O 数据。<sup>[26](https://lore.gnuweeb.org/io-uring/8829b16a-4247-4e07-aa35-c3a185780731@kernel.dk/T/)</sup> 2026 年 6 月的一个补丁提出 IORING_REGISTER_CLONE_FILES，让应用程序能把已注册文件表从一个环直接克隆到另一个环，而不必手动注销再重新注册描述符。<sup>[27](https://lists.openwall.net/linux-kernel/2026/06/24/447)</sup> 在应用侧，PostgreSQL 18 修改了 max_files_per_process，使其只统计从 postmaster 继承的文件以外另行打开的文件；在旧算法下产生容量为 644 的池的同一配置，现在给出 max_safe_fds = 990。<sup>[16](https://thebuild.com/blog/all-your-gucs-in-a-row-max_files_per_process)</sup>

## 故障模式、诊断与防御性容量规划

**描述符泄漏**是指反复获取描述符而不关闭。每个客户端连接、临时文件和泄漏的套接字都消耗一个描述符，因此泄漏的进程在 CPU 和内存仍看似健康时就撞上软限制；症状是来自每进程限制的 EMFILE 或来自系统级 file-max 的 ENFILE。<sup>[7](https://man7.org/linux/man-pages/man5/proc_sys_fs.5.html)</sup><sup> • </sup><sup>[9](https://hibug.me/linux-too-many-open-files-systemd-limitnofile)</sup> 在有记录的缩略图服务故障中，泄漏是用 lsof 找到的：数千条指向对象存储的已建立 TCP 连接发生泄漏。<sup>[9](https://hibug.me/linux-too-many-open-files-systemd-limitnofile)</sup>

**容量规划与继承。** 除非显式重置，RLIMIT_NOFILE 会沿进程树向下继承，因此要 fork 外来代码的程序应把软限制重置为 1024；过高的继承软限制会让有缺陷的库悄无声息地耗尽描述符。<sup>[6](https://0pointer.net/blog/file-descriptor-limits.html)</sup> 施加于 SSH 会话的 PAM limits.conf 设置不会被从 PID 1 启动的 systemd 服务继承，这是运维人员发现所配限制未生效的常见原因。<sup>[9](https://hibug.me/linux-too-many-open-files-systemd-limitnofile)</sup> 在容量规划上，事后复盘的指导是按需设定 LimitNOFILE 而非设为无限制：调高它会增加单个被攻陷或行为失常的进程能持有的描述符数，这并不打开新的访问途径，但会移动拒绝服务的上限。<sup>[9](https://hibug.me/linux-too-many-open-files-systemd-limitnofile)</sup> 解决故障所用的 65,536 上限，对照实测峰值 4,100，说明了此类规划通常留出的余量。<sup>[9](https://hibug.me/linux-too-many-open-files-systemd-limitnofile)</sup>

防御性检查清单很短：除非有意传给子进程，给每个描述符标记 O_CLOEXEC；记住 dup 会重置该标志；优先用 poll 或 epoll 而非 select，以免 FD_SETSIZE 限制并发；把“无限制”视为不可用，因为内核在任何情况下都拒绝无限制的 RLIMIT_NOFILE。<sup>[4](https://www.socratopia.app/library/operating-systems-en/chapter-23)</sup><sup> • </sup><sup>[10](https://biriukov.dev/docs/fd-pipe-session-terminal/1-file-descriptor-and-open-file-description/)</sup><sup> • </sup><sup>[6](https://0pointer.net/blog/file-descriptor-limits.html)</sup><sup> • </sup><sup>[15](https://github.com/systemd/systemd/issues/9205)</sup>

## References

1. [POSIX open() specification, The Open Group Base Specifications](https://pubs.opengroup.org/onlinepubs/9690949499/functions/open.html)
2. [file(9), NetBSD kernel interface documentation](https://www.daemon-systems.org/man/file.9.html)
3. [open(2), Linux man-pages (Arch mirror)](https://man.archlinux.org/man/open.2.en)
4. [Operating Systems: The Abstraction Design Approach, Chapter 23: The File System Interface](https://www.socratopia.app/library/operating-systems-en/chapter-23)
5. [Stanford CS110 Lecture 04: Filesystem Data Structures](https://web.stanford.edu/class/archive/cs/cs110/cs110.1206/lectures/04-filesystem-structures-slides.pdf)
6. [File Descriptor Limits, Lennart Poettering (0pointer.net)](https://0pointer.net/blog/file-descriptor-limits.html)
7. [proc_sys_fs(5), Linux manual page](https://man7.org/linux/man-pages/man5/proc_sys_fs.5.html)
8. [What is the maximum value and default value for fs.nr_open in Red Hat Enterprise Linux?](https://access.redhat.com/solutions/1479623)
9. [Too Many Open Files: Fix systemd LimitNOFILE (hibug.me)](https://hibug.me/linux-too-many-open-files-systemd-limitnofile)
10. [File descriptor and open file description, Viacheslav Biriukov](https://biriukov.dev/docs/fd-pipe-session-terminal/1-file-descriptor-and-open-file-description/)
11. [Solaris Internals, Chapter 14: File System Framework](https://home.mit.bme.hu/~meszaros/edu/oprendszerek/segedlet/unix/4_fajlrendszerek/solaris_internals_ch14_file_system_framework.pdf)
12. [File management in the Linux kernel, kernel documentation](https://docs.kernel.org/filesystems/files.html)
13. [Documentation for /proc/sys/fs/, Linux kernel 6.12](https://docs.kernel.org/6.12/admin-guide/sysctl/fs.html)
14. [systemd: src/core/system.conf.in](https://fossies.org/linux/systemd/src/core/system.conf.in)
15. [systemd issue #9205: Is there any way to configure systemd (pid=1)'s limits?](https://github.com/systemd/systemd/issues/9205)
16. [All Your GUCs in a Row: max_files_per_process, The Build](https://thebuild.com/blog/all-your-gucs-in-a-row-max_files_per_process)
17. [The C10K problem, Dan Kegel](https://www.kegel.com/c10k.html)
18. [io_uring(7), Linux manual page](https://man7.org/linux/man-pages/man7/io%5Furing.7.html)
19. [io_uring Registered Files Bypass Repeated Descriptor Lookup (nalar.dev)](https://nalar.dev/io-uring-registered-files-bypass-repeated-descriptor-lookup/)
20. [File Handles, Win32 apps, Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/fileio/file-handles)
21. [Creating and Opening Files, Win32 apps, Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/fileio/creating-and-opening-files)
22. [PATCHSET v6: Inherited restrictions and BPF filtering for io_uring](https://lore.gnuweeb.org/io-uring/20260119235456.1722452-8-axboe@kernel.dk/T/)
23. [Task-level io_uring restrictions, LWN.net](https://lwn.net/Articles/1054225/)
24. [Merge tag 'io_uring-bpf-restrictions.4-20260206', torvalds/linux](https://github.com/torvalds/linux/commit/591beb0e3a03258ef9c01893a5209845799a7c33)
25. [BPF comes to io_uring at last, LWN.net](https://lwn.net/Articles/1062286/)
26. [GIT PULL: io_uring updates for 7.2](https://lore.gnuweeb.org/io-uring/8829b16a-4247-4e07-aa35-c3a185780731@kernel.dk/T/)
27. [PATCH v5: io_uring/register: add IORING_REGISTER_CLONE_FILES opcode](https://lists.openwall.net/linux-kernel/2026/06/24/447)
28. [poll(2) - Linux manual page](https://linuxman7.org/linux/man-pages/man2/poll.2.html)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Operating systems › Operating system concepts

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/file-descriptor

English original: https://www.edgepedia.org/file-descriptor
