[PATCH] time: Skip overflow itimer tests on 32-bit systems

Stafford Horne shorne@gmail.com
Wed Jul 7 21:11:12 GMT 2021


On Tue, Jul 06, 2021 at 04:58:58PM -0300, Adhemerval Zanella wrote:
> 
...
> 
> Sigh... it seems that openrisc will the only *one* architecture with
> 64-bit time_t in userland which uses legacy 32-bit kernel ABI. 


In order to adhere to the "don't break userspace" rule I don't think I can
change that, I would like to.  Is there any documented migration path you know
of?

> > 
> > The below patch works for me, but there is probably a better thing to do then
> > create a new functrion.
> > 
> > 
> > 
> > diff --git a/include/time.h b/include/time.h
> > index 4372bfbd96..377a4a45ea 100644
> > --- a/include/time.h
> > +++ b/include/time.h
> > @@ -342,6 +342,14 @@ in_time_t_range (__time64_t t)
> >    return s == t;
> >  }
> >  
> > +/* Check whether T fits in a timeval32 (__int32_t).  */
> > +static inline bool
> > +in_timeval32_range (__time64_t t)
> > +{
> > +  __int32_t s = t;
> > +  return s == t;
> > +}
> > +
> 
> The name is confusing, it is mixing timeval from 'struct timeval' and
> time_t.  And there is no need to use __int32_t, we need to use it only
> on installed headers to avoid namespace pollution. 

Right, I did think about that, but just wanted to get something to show the
change, I couldn't think of a better name.

> I fact I think it would be better to just change 'in_time_t_range' to
> use int32_t internally instead of time_t; I am pretty sure that all
> usages assume that sizeof(time_t) == 32.

Yeah, I like that better too.  I will respin the patch and post again.

-Stafford


More information about the Libc-alpha mailing list