Re: [PATCH v2 1/2] tools/nolibc: add ftruncate()
From: Jordan Richards
Date: Mon Mar 02 2026 - 17:56:12 EST
Hi Thomas,
> (please Cc nolibc maintainers on nolibc changes, I only saw this by
> chance)
Will do, sorry about that.
> off_t is now always 64bit on nolibc. On 32-bit architectures however
> __NR_ftruncate only takes a 32bit value, leading to the wrong kind of
> truncation. Use __NR_ftruncate64 instead where available.
Good call. On some archs (arm, mips, ppc) register pairs need to start
in an even register. I assume adding a flag like:
#define ARCH_ALIGN_REGISTER_PAIR 1
in "nolibc/arch-xxx.h" is appropriate?
> Please also add a simple test to
> tools/testing/selftests/nolibc/nolibc-test.c
Will include in the next version.
Thanks for the review,
Jordan