Eric Botcazou <ebotca...@adacore.com> writes: > In order to avoid creating more x32-specific files, I think that we > need to move the definition of 'struct timespec' and 'struct timeval' > (both specified by POSIX) to s-linux.ads. This requires with'ing > Interfaces.C, but I think that's OK since s-linux.ads is a spin-off of > s-osinte-linux.ads which also with'es Interfaces.C.
In my worthless opinion, it is a mistake to declare POSIX data types in s-linux.ads, they should be in s-posix.ads or similar (don't worry if that's a new file; and it should not be a "leaf" package). Think of GNU/kFreeBSD and GNU/Hurd, which have nothing to do with Linux. Furthermore there should be only one declaration of type timespec (i.e. "do not repeat yourself"); that declaration should be in s-posix.ads and that declaration should "violate" POSIX like so: with System.OS_Interface; package System.POSIX is type timespec is record tv_sec : time_t; tv_nsec : System.OS_Interface.Nanoseconds_T; -- instead of "long" end record; pragma Convention (C, timespec); end System.POSIX; Each platform-specific version of System.OS_Interface should then declare their own type Nanoseconds_T. The version for x32 would declare type Nanoseconds_T is new Long_Long_Integer; -- or perhaps range -2**63 .. 2**63-1 to be more explicit? thereby really violating POSIX but all others would declare type Nanoseconds_T is new Interfaces.C.long; thereby restoring compliance with POSIX. I'm really sorry that I don't have the time to propose a proper patch but if someone does, I'd be happy to review it. -- Ludovic Brenta.