[PATCH v2 0/2] nolibc: Add dirfd()

From: Daniel Palmer

Date: Wed Oct 07 2026 - 01:29:49 EST


Add dirfd() to convert a DIR back to an fd for functions like fstatat()
that take an fd.

Change log:
v2 - Fix the name of the dirfd helper, I debated over removing the helper
as suggested by Thomas but it seems right to have the logic in a single
place.
Add test a basic test to make sure dirfd() actually does convert back
to the expected fd and using dirfd() with fstatat().

Daniel Palmer (2):
tools/nolibc: Add dirfd()
selftests/nolibc: Add test for dirfd()

tools/include/nolibc/dirent.h | 38 ++++++++++++----
tools/testing/selftests/nolibc/nolibc-test.c | 47 ++++++++++++++++++++
2 files changed, 77 insertions(+), 8 deletions(-)

--
2.53.0