Skip to content

nolibc: Add getcwd() and readlink()

Daniel Palmer lkml llvm 3 versions – Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 3 repliesApplied
  2. v23 patches 1 replySuperseded
  3. v13 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- Addressed the issues noted by sashiko (impressed by how good it is now)
- Use __LINE__ for the error numbers in the test to make it easy to spot where it broke.
- Redid the nolibc test for all archs, all passed.

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/3tools/nolibc: unistd: Add getcwd()tools/include/nolibc/unistd.h+42 -01 reply
2/3tools/nolibc: unistd: Add readlink()tools/include/nolibc/unistd.h+16 -01 reply
3/3selftests/nolibc: Add test for getcwd() and readlink()tools/testing/selftests/nolibc/nolibc-test.c+53 -01 reply

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchWilly Tarreau
1/3A-b
2/3A-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/3] nolibc: Add getcwd() and readlink()

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.

v3:
- Addressed the issues noted by sashiko (impressed by how good it is now)
- Use __LINE__ for the error numbers in the test to make it easy to spot where it broke.
- Redid the nolibc test for all archs, all passed.

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                | 58 ++++++++++++++++++++
 tools/testing/selftests/nolibc/nolibc-test.c | 53 ++++++++++++++++++
 2 files changed, 111 insertions(+)
Signature · 1 line
2.53.0