This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC v3 01/23] sysdeps/nanosleep: Use clock_nanosleep_time64 if avaliable
On Sat, Jul 20, 2019 at 7:24 AM Stepan Golosunov <stepan@golosunov.pp.ru> wrote:
>
> 19.07.2019 в 10:25:46 -0700 Alistair Francis написал:
> > On Tue, Jul 16, 2019 at 10:16 PM Florian Weimer <fweimer@redhat.com> wrote:
> > >
> > > * Alistair Francis:
> > >
> > > > +#if __TIMESIZE == 32
> > > > +struct timespec64
> > > > +{
> > > > + long int tv_sec; /* Seconds. */
> > > > + long int tv_nsec; /* Nanoseconds. */
> > > > +};
> > > > +#endif
> > > > +
> > > > int
> > > > thrd_sleep (const struct timespec* time_point, struct timespec* remaining)
> > > > {
> > > > INTERNAL_SYSCALL_DECL (err);
> > > > - int ret = INTERNAL_SYSCALL_CANCEL (nanosleep, err, time_point, remaining);
> > > > + int ret;
> > > > +
> > > > +#ifdef __ASSUME_TIME64_SYSCALLS
> > > > + ret = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, err, CLOCK_REALTIME,
> > > > + 0, time_point, remaining);
> > > > +#else
> > > > +# ifdef __NR_clock_nanosleep_time64
> > > > +# if __TIMESIZE == 64
> > > > + long int ret_64;
> > > > +
> > > > + ret_64 = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, err, CLOCK_REALTIME,
> > > > + 0, time_point, remaining);
> > > > +
> > > > + if (ret_64 == 0 || errno != ENOSYS)
> > > > + ret = ret_64;
> > > > +# else
> > > > + timespec64 ts;
> > > > +
> > > > + ret = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, err,
> > > > + CLOCK_REALTIME, 0, time_point,
> > > > + ts);
> > > > +
> > > > + if (ret == 0 || errno != ENOSYS) {
> > > > + remaining->tv_sec = ts.tv_sec;
> > > > + remaining->tv_nsec = ts.tv_nsec;
> > > > + return ret;
> > > > + }
> > > > +# endif
> > > > +# endif
> > > > + ret = INTERNAL_SYSCALL_CANCEL (nanosleep, err, time_point, remaining);
> > > > +#endif
> > > > +
> > >
> > > I think this changes the ABI of thrd_sleep if
> > > __NR_clock_nanosleep_time64 is defined (and __NR_nanosleep was defined
> > > before).
> >
> > I'm not sure I understand, which part changes the ABI?
>
> Parts where time_point (2 cases) and remaining (1 case) are passed to
> the clock_nanosleep_time64 syscall while __TIMESIZE == 32.
Yep, I think I have fixed everything up in the next version.
Alistair