[PATCH] PR ada/54040: [x32] Incorrect timeval and timespec
Arnaud Charlet
charlet@adacore.com
Mon Nov 18 15:36:00 GMT 2013
> Ada was using long for time_t and
>
> type timeval is array (1 .. 2) of C.long
>
> It assumes that the type of tv_nsec is the same as tv_sec.
Yes, and that was indeed wrong/dangerous.
> > --- s-osinte-solaris-posix.ads (revision 298928)
> > +++ s-osinte-solaris-posix.ads (working copy)
> > @@ -513,7 +513,7 @@
> >
> > type timespec is record
> > tv_sec : time_t;
> > - tv_nsec : long;
> > + tv_nsec : time_t;
> > end record;
> > pragma Convention (C, timespec);
> >
> > But I'd rather settle on which type is appropriate for the tv_nsec
> > field before making this change.
> >
>
> __syscall_slong_t is a Linux specific type. We
> can add tv_nsec_t, which should be the same
> as time_t for all the current targets.
Introducing tv_nsec_t looks reasonable to me.
Arno
More information about the Gcc-patches
mailing list