Re: "Canonical" way of changing the size of off_t, ino_t, ...

Stefan Heinzmann <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On 27/04/2025 20:47, Brian Inglis wrote:
> On 2025-04-27 10:27, Stefan Heinzmann wrote:
>> Hello list,
>>
>> I am using the newlib build for arm-none-eabi from ArchLinux for 
>> simplicity, but I now need to change the size of some predefined POSIX 
>> types. I wasn't able to find clear instructions how to do this 
>> properly, hence my question here.
>>
>> The default sizes of offs_t, ino_t, and possibly other types are too 
>> small for my use. Ideally I would like to customize the newlib build 
>> in a way that doesn't require the user builds to define anything, i.e. 
>> that the correct sizes are picked up from the newlib headers 
>> automatically. How do I do that? Are there configuration options I can 
>> use when building newlib? Do I have to patch the source, and if so, 
>> where?
>>
>> I note that there is support for off64_t and the respective functions, 
>> but I would prefer to have off_t defined as 64-bit, in a way similar 
>> to _FILE_OFFSET_BITS=64 in glibc.
>>
>> Similarly, how do I make ino_t larger? What about dev_t, and other 
>> POSIX types?
>>
>> Thanks for your help!
> 
> Please first read the FAQ, and follow all the steps, but ensure that you 
> do not redefine anything provided or assumed by your compiler or binutils:
> 
>      https://www.sourceware.org/newlib/faq.html
> 

I read the FAQ again, but it didn't get me any further. I don't want to 
port to a new platform, I just want to change the definition of a couple 
of types. Since I'm dealing with arm-none-eabi, there's no underlying 
system whose definitions I'd have to follow.

The types I want to modify are POSIX types, so I don't see how the 
compiler or binutils would have a bearing on it.

I note that include/sys/_types.h contains code like this:

#ifndef __machine_ino_t_defined
     // define __ino_t in some system dependent way
#endif

which suggests to me that there is a method to provide such definitions 
from the outside. I don't quite understand how this is meant to be used, 
and whether it is a hook that I can employ to insert my definition 
without needing to patch the source.

Or am I looking at the wrong place altogether?

Thanks
Stefan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.