Re: [PATCH v2 1/2] tools/nolibc: add ftruncate()
From: Thomas Weißschuh
Date: Mon Mar 02 2026 - 18:10:07 EST
On 2026-03-02 22:20:43+0000, Jordan Richards wrote:
(...)
> > 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?
I would use a custom sys_ftruncate64() wrapper function for those.
Similar to sys_mmap() on some architectures or sys_fork() on s390.
(...)
Thomas