Files
freebsd/lib/libc/gen
Jitendra Bhati dd532ad133 fts: reduce fd usage by storing fts_dirfd on directory entries only
Previously fts_build() called _dup(_dirfd(dirp)) for every child
entry, holding N simultaneous fds for a directory with N children.

Redefine fts_dirfd: instead of a fd for the entry's parent
directory, it is now a fd for the entry itself, set only for
directory entries. One dup per directory in fts_build() instead
of one per child.  Close fts_dirfd during the directory post-order
visit, before advancing to its sibling.

To access a file using fd-relative operations, callers should use
openat(ent->fts_parent->fts_dirfd, ent->fts_name, ...) instead of
openat(ent->fts_dirfd, ent->fts_name, ...).  The fd is valid until the
directory's post-order visit (FTS_DP).

Reported by:    Mark Johnston <[email protected]>
Fixes:          4bd01d6ae0 (fts: refactor to use fd-relative operations)
Sponsored by:   Google LLC (GSoC 2026)
Reviewed by:	asomers
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2360
2026-08-10 10:14:16 -06:00
..
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2024-07-13 00:16:24 -05:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2026-02-02 16:46:53 +01:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2026-06-19 10:53:45 -04:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2026-02-02 17:41:18 +01:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2025-07-06 23:08:37 +00:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2024-10-07 15:41:14 -03:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2026-02-02 16:46:53 +01:00
2023-11-01 16:44:30 -06:00
2026-01-16 22:43:40 -08:00
2023-11-01 16:44:30 -06:00
2026-05-10 17:53:20 +03:00
2023-11-26 22:23:28 -07:00
…
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2025-09-26 09:51:28 +03:00
2023-11-26 22:23:28 -07:00
2025-09-26 09:51:28 +03:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-08-16 11:55:10 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2025-06-23 11:34:45 +02:00
2025-07-04 14:42:33 +00:00
2023-11-26 22:23:28 -07:00
…
…
…
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2026-05-21 11:37:33 +02:00
2026-02-02 16:46:53 +01:00
2026-02-02 16:46:53 +01:00
2026-04-04 09:11:10 +02:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2025-04-17 18:19:44 +03:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2025-09-11 17:12:22 +02:00
2023-11-01 16:44:30 -06:00
2026-02-02 16:46:53 +01:00
2026-02-02 16:46:53 +01:00
2023-11-26 22:23:28 -07:00
…
…
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2025-06-11 17:16:22 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2026-02-02 16:46:53 +01:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
…
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
…
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00