This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v4] sysdeps/nanosleep: Use clock_nanosleep_time64 if avaliable
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-alpha at sourceware dot org
- Date: Wed, 6 Nov 2019 10:03:39 -0300
- Subject: Re: [PATCH v4] sysdeps/nanosleep: Use clock_nanosleep_time64 if avaliable
- References: <20191105234058.22483-1-alistair.francis@wdc.com>
On 05/11/2019 20:40, Alistair Francis wrote:
> The nanosleep syscall is not supported on newer 32-bit platforms (such
> as RV32). To fix this issue let's use clock_nanosleep_time64 if it is
> avaliable.
>
> Let's use CLOCK_REALTIME when calling clock_nanosleep_time64 as the
> Linux specification says:
> "POSIX.1 specifies that nanosleep() should measure time against the
> CLOCK_REALTIME clock. However, Linux measures the time using the
> CLOCK_MONOTONIC clock. This probably does not matter, since the POSIX.1
> specification for clock_settime(2) says that discontinuous changes in
> CLOCK_REALTIME should not affect nanosleep()"
>
> Let's also expose __clock_nanosleep internally to avoid code
> duplication.
> ---
> This was patch was runtime tested with RV32 and RV64
> It was build tested using the ./scripts/build-many-glibcs.py script.
>
> I am currently running:
> $ make ; make install ; make check
> tests on native ARM (32-bit) with the following three confiugrations:
> - 4.19 Kernel and 4.19 Headers
> - 5.2 Kernel and 4.19 Headers
> - 5.2 Kernel and 5.2 Headers
> I should have the results tomorrow.
>
> v4:
> - Rebase on master
> - Use __clock_nanosleep to avoid duplicate implementations
> - Fix the error handling when a syscall fails
I sent a nanosleep/thrd_sleep refactor that should simplify this code
with advantage it consolidates more symbols on libc.so (instead of
exporting more through GLIBC_PRIVATE).