This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/3] Refactor nanosleep in terms of clock_nanosleep


On Wed, Nov 06, 2019 at 09:52:44AM -0300, Adhemerval Zanella wrote:
> The generic version is straightforward.  For Hurd, its nanosleep
> implementation is moved to clock_nanosleep with adjustments from
> generic unix implementation.
> 
> The generic clock_nanosleep unix version is also removed since
> it calls nanosleep.
> 
> Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.
> ---
>  include/time.h                            |  3 +
>  posix/nanosleep.c                         | 13 ++--
>  sysdeps/{unix => mach}/clock_nanosleep.c  | 79 +++++++++++++++++------
>  sysdeps/mach/nanosleep.c                  | 79 -----------------------
>  sysdeps/unix/sysv/linux/clock_nanosleep.c |  2 +-
>  sysdeps/unix/sysv/linux/nanosleep.c       | 31 ---------
>  time/clock_nanosleep.c                    |  2 +-
>  7 files changed, 71 insertions(+), 138 deletions(-)
>  rename sysdeps/{unix => mach}/clock_nanosleep.c (59%)
>  delete mode 100644 sysdeps/mach/nanosleep.c
>  delete mode 100644 sysdeps/unix/sysv/linux/nanosleep.c
> 
> diff --git a/include/time.h b/include/time.h
> index 8ac58e891b..b3e635395d 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -25,6 +25,9 @@ libc_hidden_proto (__clock_gettime)
>  extern __typeof (clock_settime) __clock_settime;
>  libc_hidden_proto (__clock_settime)
>  
> +extern __typeof (clock_nanosleep) __clock_nanosleep;
> +libc_hidden_proto (__clock_nanosleep);
> +
>  #ifdef __linux__
>  extern __typeof (clock_adjtime) __clock_adjtime;
>  libc_hidden_proto (__clock_adjtime);
> diff --git a/posix/nanosleep.c b/posix/nanosleep.c
> index d8564c7119..ed41c8cce7 100644
> --- a/posix/nanosleep.c
> +++ b/posix/nanosleep.c
> @@ -24,10 +24,13 @@ int
>  __nanosleep (const struct timespec *requested_time,
>  	     struct timespec *remaining)
>  {
> -  __set_errno (ENOSYS);
> -  return -1;
> +  int ret = __clock_nanosleep (CLOCK_REALTIME, 0, requested_time, remaining);

Shouldn't it set flags to TIMER_ABSTIME?

In the current form it causes a regression when the syscall is interrupted
by signal - "remaining" is updated by the kernel but __clock_nanosleep
leaves it unchanged.


-- 
ldv

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]