[PATCH v3 0/2] nolibc: Add fallocate()

From: Daniel Palmer

Date: Thu Apr 30 2026 - 12:47:42 EST


While poking around with my "static PIE for nommu" series I found
I needed fallocate(). Implementing it turned out a bit more
interesting than I thought it would be due to how the offset and
size need to be passed on 32bit machines.

v3:
- Reworked the test a bit, ran it on all the targets I could get
to run (s390, loongarch and sh currently don't work for me).
sparc32 doesn't seem to support fallocate() so made it skip
the test.
- Rebase on nolibc/for-next with the large file support bits.

v2:
- Addressed Thomas' comments
- Trial and error'd a test for the arguments being passed correctly.
Hopefully someone smarter than I am can tell if it actually works.

Daniel Palmer (2):
tools/nolibc: fcntl: Add fallocate()
selftests/nolibc: Add a very basic test for fallocate()

tools/include/nolibc/arch-mips.h | 11 ++++
tools/include/nolibc/fcntl.h | 33 ++++++++++
tools/include/nolibc/sys.h | 8 +++
tools/testing/selftests/nolibc/nolibc-test.c | 69 ++++++++++++++++++++
4 files changed, 121 insertions(+)

--
2.53.0