Re: [PATCH] Add build time guard to detect off_t mismatch

Richard Weinberger <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
----- Ursprüngliche Mail -----
> Von: "Jan Kiszka" <[email protected]>
> An: "richard" <[email protected]>, "xenomai" <[email protected]>
> Gesendet: Donnerstag, 7. Mai 2026 14:26:37
> Betreff: Re: [PATCH] Add build time guard to detect off_t mismatch

> On 07.05.26 14:23, Richard Weinberger wrote:
>> When Xenomai is built without _FILE_OFFSET_BITS=64 on a 32 bit system,
>> which is the default, but the Xenomai application itself is built later
>> with _FILE_OFFSET_BITS=64, we get a nasty ABI mismatch. Since only very
>> few cobalt syscalls use off_t, the mismatch goes undiscovered for a
>> surprisingly long time. In my case it surfaced only after a realtime
>> application which uses mmap() failed sometimes at mmap() depending on
>> what functions it called before mmap(). In the good cases it used to
>> work by chance since the extra bytes used for off_t on the stack were
>> zero.
>> 
>> To save the next person in the same situation a lot of time, compute
>> the size of off_t at configure time and compare it against the
>> application's sizeof(off_t) via a static assertion in a new generated
>> header, which is included when building Xenomai applications.
>> 
> 
> This should have been resolved (but apparently we missed most of it) by
> 0bb6608b6fa7129de1ff4213ddf31298616cbf23. Can you name some of the
> remaining mismatches?

In my case it was just mmap(). But wouldn't it hurt at any function
or data structure exposed by Xenomai which uses off_t?

So, I suggest applying my change as safeguard mechanism.

Thanks,
//richard
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.