Commit Graph

9 Commits

Author SHA1 Message Date
Adhemerval Zanella
215078017f nptl: Replace non cancellable pause/nanosleep with futex
To help y2038 work avoid duplicate all the logic of nanosleep on
non cancellable version, the patch replace it with a new futex
operation, lll_timedwait.  The changes are:

  - Add a expected value for __lll_clocklock_wait, so it can be used
    to wait for generic values.

  - Remove its internal atomic operation and move the logic to
    __lll_clocklock.  It makes __lll_clocklock_wait even more generic
    and __lll_clocklock slight faster on fast-path (since it won't
    require a function call anymore).

  - Add lll_timedwait, which uses __lll_clocklock_wait, to replace both
    __pause_nocancel and __nanosleep_nocancel.

It also allows remove the sparc32 __lll_clocklock_wait implementation
(since it is similar to the generic one).

Checked on x86_64-linux-gnu, sparcv9-linux-gnu, and i686-linux-gnu.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-10-31 11:09:01 -03:00
Lukasz Majewski
4812365660 time: Introduce function to check correctness of nanoseconds value
The valid_nanoseconds () static inline function has been introduced to
check if nanoseconds value is in the correct range - greater or equal to
zero and less than 1000000000.

The explicit #include <time.h> has been added to files where it was
missing.

The __syscall_slong_t type for ns has been used to avoid issues on x32.

Tested with:
- scripts/build-many-glibcs.py
- make PARALLELMFLAGS="-j12" && make PARALLELMFLAGS="-j12" xcheck on x86_64
2019-10-27 21:49:25 +01:00
Paul Eggert
5a82c74822 Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:

sed -ri '
  s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
  s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
  $(find $(git ls-files) -prune -type f \
      ! -name '*.po' \
      ! -name 'ChangeLog*' \
      ! -path COPYING ! -path COPYING.LIB \
      ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
      ! -path manual/texinfo.tex ! -path scripts/config.guess \
      ! -path scripts/config.sub ! -path scripts/install-sh \
      ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
      ! -path INSTALL ! -path  locale/programs/charmap-kw.h \
      ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
      ! '(' -name configure \
            -execdir test -f configure.ac -o -f configure.in ';' ')' \
      ! '(' -name preconfigure \
            -execdir test -f preconfigure.ac ';' ')' \
      -print)

and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:

  chmod a+x sysdeps/unix/sysv/linux/riscv/configure
  # Omit irrelevant whitespace and comment-only changes,
  # perhaps from a slightly-different Autoconf version.
  git checkout -f \
    sysdeps/csky/configure \
    sysdeps/hppa/configure \
    sysdeps/riscv/configure \
    sysdeps/unix/sysv/linux/csky/configure
  # Omit changes that caused a pre-commit check to fail like this:
  # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
  git checkout -f \
    sysdeps/powerpc/powerpc64/ppc-mcount.S \
    sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
  # Omit change that caused a pre-commit check to fail like this:
  # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
  git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 02:43:31 -07:00
Mike Crowe
59213094c8 nptl: Rename lll_timedlock to lll_clocklock and add clockid parameter
Rename lll_timedlock to lll_clocklock and add clockid
parameter to indicate the clock that the abstime parameter should
be measured against in preparation for adding
pthread_mutex_clocklock.

The name change mirrors the naming for the exposed pthread functions:

 timed => absolute timeout measured against CLOCK_REALTIME (or clock
          specified by attribute in the case of pthread_cond_timedwait.)

 clock => absolute timeout measured against clock specified in preceding
          parameter.

	* sysdeps/nptl/lowlevellock.h (lll_clocklock): Rename from
	lll_timedlock and add clockid parameter. (__lll_clocklock): Rename
	from __lll_timedlock and add clockid parameter.
	* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_clocklock):
	Likewise.
	* nptl/lll_timedlock_wait.c (__lll_clocklock_wait): Rename from
	__lll_timedlock_wait and add clockid parameter. Use __clock_gettime
	rather than __gettimeofday so that clockid can be used. This means
	that conversion from struct timeval is no longer required.
	* sysdeps/sparc/sparc32/lowlevellock.c (lll_clocklock_wait):
	Likewise.
	* sysdeps/sparc/sparc32/lll_timedlock_wait.c: Update comment to
	refer to __lll_clocklock_wait rather than __lll_timedlock_wait.
	* nptl/pthread_mutex_timedlock.c (lll_clocklock_elision): Rename
	from lll_timedlock_elision, add clockid parameter and use
	meaningful names for other parameters. (__pthread_mutex_timedlock):
	Pass CLOCK_REALTIME where necessary to lll_clocklock and
	lll_clocklock_elision.
	* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
	(lll_clocklock_elision): Rename from lll_timedlock_elision and add
	clockid parameter. (__lll_clocklock_elision): Rename from
	__lll_timedlock_elision and add clockid parameter.
	* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/elision-timed.c
	(__lll_lock_elision): Call __lll_clocklock_elision rather than
	__lll_timedlock_elision. (EXTRAARG): Add clockid parameter.
	(LLL_LOCK): Likewise.
	* sysdeps/unix/sysv/linux/s390/elision-timed.c: Likewise.
	* sysdeps/unix/sysv/linux/x86/elision-timed.c: Likewise.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-07-12 13:36:25 +00:00
Joseph Myers
04277e02d7 Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2019-01-01 00:11:28 +00:00
Joseph Myers
688903eb3e Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2018-01-01 00:32:25 +00:00
Joseph Myers
bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Joseph Myers
f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Roland McGrath
68c97aef62 Split timed-wait functions out of nptl/lowlevellock.c. 2015-05-26 14:49:13 -07:00