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

Daniel Palmer posted 2 patches 1 month, 4 weeks ago
There is a newer version of this series
tools/include/nolibc/arch-mips.h             | 11 ++++
tools/include/nolibc/fcntl.h                 | 32 +++++++++++
tools/include/nolibc/sys.h                   |  8 +++
tools/testing/selftests/nolibc/nolibc-test.c | 58 ++++++++++++++++++++
4 files changed, 109 insertions(+)
[PATCH v2 0/2] nolibc: Add fallocate()
Posted by Daniel Palmer 1 month, 4 weeks ago
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.

I have ran the tests on m68k, arm, arm64, riscv[32|64], x86_64,
i386, x32 (v2: + lots of mips, ppc..) . I probably missed something,
maybe there is a better way to do this. Maybe it can't actually
pass an offset or size >4GB on x32? (v2: I think this is good now)

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                 | 32 +++++++++++
 tools/include/nolibc/sys.h                   |  8 +++
 tools/testing/selftests/nolibc/nolibc-test.c | 58 ++++++++++++++++++++
 4 files changed, 109 insertions(+)

-- 
2.51.0
Re: [PATCH v2 0/2] nolibc: Add fallocate()
Posted by Thomas Weißschuh 1 month, 2 weeks ago
Hi Daniel,

On 2026-04-17 20:26:20+0900, Daniel Palmer wrote:
> 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.
> 
> I have ran the tests on m68k, arm, arm64, riscv[32|64], x86_64,
> i386, x32 (v2: + lots of mips, ppc..) . I probably missed something,
> maybe there is a better way to do this. Maybe it can't actually
> pass an offset or size >4GB on x32? (v2: I think this is good now)
> 
> 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()

Could you rebase the series on latest nolibc/for-next?
Now that the large file support has landed this should make more sense.

>  tools/include/nolibc/arch-mips.h             | 11 ++++
>  tools/include/nolibc/fcntl.h                 | 32 +++++++++++
>  tools/include/nolibc/sys.h                   |  8 +++
>  tools/testing/selftests/nolibc/nolibc-test.c | 58 ++++++++++++++++++++
>  4 files changed, 109 insertions(+)
> 
> -- 
> 2.51.0
>