Page MenuHomeFreeBSD

Use kinfo_getfile() to implement fdwalk().
ClosedPublic

Authored by jhb on Feb 23 2021, 6:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 12, 1:21 PM
Unknown Object (File)
Sun, Apr 12, 9:16 AM
Unknown Object (File)
Thu, Apr 9, 9:44 PM
Unknown Object (File)
Thu, Apr 9, 12:22 AM
Unknown Object (File)
Sat, Mar 21, 2:04 PM
Unknown Object (File)
Mar 17 2026, 10:28 AM
Unknown Object (File)
Jan 31 2026, 3:03 PM
Unknown Object (File)
Jan 13 2026, 2:42 AM
Subscribers

Details

Summary

Previously, the kern.file sysctl (which queries the global file table)
was queried and the results saved in an on-stack buffer. With a
sufficiently active system the sysctl's output could overflow the
stack's available space. Instead, switch to kinfo_getfile() from
libutil. This uses a sysctl which queries only the open files for the
current process, and it uses heap space instead of the stack to store
the sysctl output.

PR: 253602
Submittted by: ps (build glue patches)

Test Plan
  • ps@ kept having this port fail to build as its internal tests crashed due to the stack overflow with the old implementation
  • I've tested this on amd64 as part of a poudriere build for my desktop

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 37328
Build 34217: arc lint + arc unit