From: linux@weissschuh.net
To: Daniel Palmer <daniel@thingy.jp>
Cc: w@1wt.eu, linux-kernel@vger.kernel.org, david.laight.linux@gmail.com
Subject: Re: [PATCH v3 0/3] nolibc: Add dirfd()
Date: Mon, 2 Nov 2026 02:28:14 +0000 [thread overview]
Message-ID: <61e37c86-00a0-49c9-aa23-05be83eb8e4e@t-8ch.de> (raw)
In-Reply-To: <20261031043000.145709-1-daniel@thingy.jp>
On 2026-10-31 13:29:57+0900, Daniel Palmer wrote:
> Add dirfd() to convert a DIR back to an fd for functions like fstatat()
> that take an fd.
>
> Change log:
> v3 - Split the internal helper into its own commit.
> - test: just stat one child instead of all of them
> - According to POSIX (https://man7.org/linux/man-pages/man3/dirfd.3.html) errno
> should be EINVAL on failure, so closedir() is now untouched as it is setting EBADF.
> This makes the diff a little cleaner too.
> - Replace i with fd in some places so isn't confused with -1.
> - Due to all of the changes I didn't add trailers from v2.
> 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 (3):
> tools/nolibc: Add internal __nolibc_dirfd() helper
> tools/nolibc: Add dirfd()
> selftests/nolibc: Add test for dirfd()
Applied, thanks!
Note: Now I hate that we sometime override readdir_r() for the selftests.
I tried to enable your tests for non-nolibc builds but was running into
EINVAL errors and was wondering where these came from. I'll drop that
local definition and just disable the deprecation warnings.
> tools/include/nolibc/dirent.h | 37 ++++++++++++++----
> tools/testing/selftests/nolibc/nolibc-test.c | 40 ++++++++++++++++++++
> 2 files changed, 70 insertions(+), 7 deletions(-)
>
> --
> 2.53.0
>
prev parent reply other threads:[~2026-11-02 2:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 4:29 Daniel Palmer
2026-10-31 4:29 ` [PATCH v3 1/3] tools/nolibc: Add internal __nolibc_dirfd() helper Daniel Palmer
2026-10-31 4:29 ` [PATCH v3 2/3] tools/nolibc: Add dirfd() Daniel Palmer
2026-10-31 4:30 ` [PATCH v3 3/3] selftests/nolibc: Add test for dirfd() Daniel Palmer
2026-11-02 2:28 ` linux [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=61e37c86-00a0-49c9-aa23-05be83eb8e4e@t-8ch.de \
--to=linux@weissschuh.net \
--cc=daniel@thingy.jp \
--cc=david.laight.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=w@1wt.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®