From: Daniel Palmer <daniel@thingy.jp>
To: w@1wt.eu, linux@weissschuh.net
Cc: linux-kernel@vger.kernel.org, Daniel Palmer <daniel@thingy.jp>
Subject: [PATCH v2 0/3] nolibc: Add getcwd() and readlink()
Date: Tue, 30 Jun 2026 22:24:16 +0900 [thread overview]
Message-ID: <20260630132419.2523890-1-daniel@thingy.jp> (raw)
I needed getcwd() for something. So I added that, then realised
I also needed readlink() to test the result of getcwd().
This adds getcwd() and readlink() then adds a test that uses
both.
Note: getcwd() has some behaviour where if the current directory
is unreachable then the kernel returns "(unreachable)" and this
needs some special handling. I checked what musl was doing for
this. It seems pretty difficult to test and maybe needs some
calls nolibc doesn't have yet. Basically: It looks right but
there is no test.
v2:
- Addressed Thomas' comments for readlink() and making the test depend on proc.
- Filled out getcwd() so it matches what musl is doing.
- Expanded the test a little to try to cover passing bad arguments.
Daniel Palmer (3):
tools/nolibc: unistd: Add getcwd()
tools/nolibc: unistd: Add readlink()
selftests/nolibc: Add test for getcwd() and readlink()
tools/include/nolibc/unistd.h | 56 ++++++++++++++++++++
tools/testing/selftests/nolibc/nolibc-test.c | 48 +++++++++++++++++
2 files changed, 104 insertions(+)
--
2.53.0
next reply other threads:[~2026-06-30 13:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 13:24 Daniel Palmer [this message]
2026-06-30 13:24 ` [PATCH v2 1/3] tools/nolibc: unistd: Add getcwd() Daniel Palmer
2026-06-30 13:24 ` [PATCH v2 2/3] tools/nolibc: unistd: Add readlink() Daniel Palmer
2026-06-30 13:24 ` [PATCH v2 3/3] selftests/nolibc: Add test for getcwd() and readlink() Daniel Palmer
2026-06-30 18:47 ` Thomas Weißschuh
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=20260630132419.2523890-1-daniel@thingy.jp \
--to=daniel@thingy.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--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
Powered by JetHome