Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Mar 2017 15:16:11 -0700
From:      Ngie Cooper <yaneurabeya@gmail.com>
To:        Eric van Gyzen <vangyzen@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r315280 - in head/sys: kern sys
Message-ID:  <CAGHfRMCxcbYCUw=nnm4KOQpvgQX_-TwQXvU-f%2BgZjAKX4=zy=A@mail.gmail.com>
In-Reply-To: <201703141906.v2EJ6i0x096677@repo.freebsd.org>
References:  <201703141906.v2EJ6i0x096677@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 14, 2017 at 12:06 PM, Eric van Gyzen <vangyzen@freebsd.org> wrote:
> Author: vangyzen
> Date: Tue Mar 14 19:06:44 2017
> New Revision: 315280
> URL: https://svnweb.freebsd.org/changeset/base/315280
>
> Log:
>   When the RTC is adjusted, reevaluate absolute sleep times based on the RTC
>
>   POSIX 2008 says this about clock_settime(2):
>
>       If the value of the CLOCK_REALTIME clock is set via clock_settime(),
>       the new value of the clock shall be used to determine the time
>       of expiration for absolute time services based upon the
>       CLOCK_REALTIME clock.  This applies to the time at which armed
>       absolute timers expire.  If the absolute time requested at the
>       invocation of such a time service is before the new value of
>       the clock, the time service shall expire immediately as if the
>       clock had reached the requested time normally.
>
>       Setting the value of the CLOCK_REALTIME clock via clock_settime()
>       shall have no effect on threads that are blocked waiting for
>       a relative time service based upon this clock, including the
>       nanosleep() function; nor on the expiration of relative timers
>       based upon this clock.  Consequently, these time services shall
>       expire when the requested relative interval elapses, independently
>       of the new or old value of the clock.
>
>   When the real-time clock is adjusted, such as by clock_settime(3),
>   wake any threads sleeping until an absolute real-clock time.
>   Such a sleep is indicated by a non-zero td_rtcgen.  The sleep functions
>   will set that field to zero and return zero to tell the caller
>   to reevaluate its sleep duration based on the new value of the clock.
>
>   At present, this affects the following functions:
>
>       pthread_cond_timedwait(3)
>       pthread_mutex_timedlock(3)
>       pthread_rwlock_timedrdlock(3)
>       pthread_rwlock_timedwrlock(3)
>       sem_timedwait(3)
>       sem_clockwait_np(3)
>
>   I'm working on adding clock_nanosleep(2), which will also be affected.
>
>   Reported by:  Sebastian Huber <sebastian.huber@embedded-brains.de>
>   Reviewed by:  jhb, kib
>   MFC after:    2 weeks
>   Relnotes:     yes
>   Sponsored by: Dell EMC
>   Differential Revision:        https://reviews.freebsd.org/D9791

Thanks for this!

I'll take a look at running "open_posix_testsuite" from LTP and (when
time/appropriate), I'll help out with integrating in the
clock_nanosleep tests from NetBSD
(contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c, ).

Cheers!
-Ngie



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGHfRMCxcbYCUw=nnm4KOQpvgQX_-TwQXvU-f%2BgZjAKX4=zy=A>