Commit Graph

5452 Commits

Author SHA1 Message Date
Adhemerval Zanella
112a0ae18b m68k: Remove vDSO support
Although defined in initial TLS/NPTL ABI for m68k and ColdFire [1], kernel
support was never pushed upstream.  This patch removes the unused m68k
vDSO support.

Checked with a build against m68k and m68k-coldfire and some basic
tests on ARAnyM.

	* sysdeps/unix/sysv/linux/m68k/Makefile (sysdep_routines,
	sysdep-rtld-routines): Remove rules.
	* sysdeps/unix/sysv/linux/m68k/Versions (libc) [GLIBC_PRIVATE]:
	Remove __vdso_atomic_cmpxchg_32 and __vdso_atomic_barrier.
	(ld) [GLIBC_PRIVATE]: __rtld___vdso_read_tp,
	__rtld___vdso_atomic_cmpxchg_32, and __rtld___vdso_atomic_barrier.
	* sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h
	(atomic_compare_and_exchange_val_acq, atomic_full_barrier): Remove
	vDSO path for SHARED.
	* sysdeps/unix/sysv/linux/m68k/init-first.c: Remove file.
	* sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m68k-helpers.S: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m68k-vdso.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m68k-vdso.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m68k-helpers.c: New file.

[1] https://lists.debian.org/debian-68k/2007/11/msg00071.html
2019-06-17 09:29:01 -03:00
Florian Weimer
48c3c12389 Linux: Fix __glibc_has_include use for <sys/stat.h> and statx
The identifier linux is used as a predefined macro, so the actually
used path is 1/stat.h or 1/stat64.h.  Using the quote-based version
triggers a file lookup for /usr/include/bits/linux/stat.h (or whatever
directory is used to store bits/statx.h), but since bits/ is pretty
much reserved by glibc, this appears to be acceptable.

This is related to GCC PR 80005: incorrect macro expansion of the
argument of __has_include.

Suggested by Zack Weinberg.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-06-14 16:28:41 +02:00
Joseph Myers
cf27468602 Add IPV6_ROUTER_ALERT_ISOLATE from Linux 5.1 to bits/in.h.
This patch adds the new constant IPV6_ROUTER_ALERT_ISOLATE from Linux
5.1 to sysdeps/unix/sysv/linux/bits/in.h.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/bits/in.h (IPV6_ROUTER_ALERT_ISOLATE):
	New macro.
2019-06-13 16:08:20 +00:00
Joseph Myers
a26e2e9fea Allow memset local PLT reference for powerpc soft-float.
Some recent change on GCC mainline resulted in the localplt test
failing for powerpc soft-float (not sure exactly when, as the failure
appeared when there were other build test failures as well;
<https://sourceware.org/ml/libc-testresults/2019-q2/msg00261.html>
shows it remaining when other failures went away).  The problem is a
call to memset that GCC now generates in the libgcc long double code.

Since memset is documented as a function GCC may always implicitly
generate calls to, it seems reasonable to allow that local PLT
reference (just like those for libgcc functions that GCC implicitly
generates calls to and that are also exported from libc.so), which
this patch does.

Tested for powerpc soft-float with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/localplt.data:
	Allow memset in libc.so.
2019-06-13 12:21:50 +00:00
Florian Weimer
744e829637 Linux: Deprecate <sys/sysctl.h> and sysctl
Now that there are no internal users of __sysctl left, it is possible
to add an unconditional deprecation warning to <sys/sysctl.h>.

To avoid a test failure due this warning in check-install-headers,
skip the test for sys/sysctl.h.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2019-06-12 14:32:08 +02:00
Florian Weimer
5dad6ffbb2 <sys/stat.h>: Use Linux UAPI header for statx if available and useful
This will automatically import new STATX_* constants.  It also avoids
a conflict between <sys/stat.h> and <linux/stat.h>.
2019-06-12 13:04:43 +02:00
Florian Weimer
51ea67d548 Linux: Add getdents64 system call
No 32-bit system call wrapper is added because the interface
is problematic because it cannot deal with 64-bit inode numbers
and 64-bit directory hashes.

A future commit will deprecate the undocumented getdirentries
and getdirentries64 functions.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-06-07 09:27:01 +02:00
Florian Weimer
28dd393922 riscv: Do not use __has_include__
The user-visible preprocessor construct is called __has_include.
2019-06-06 11:24:32 +02:00
Florian Weimer
6b33f373c7 arm: Remove ioperm/iopl/inb/inw/inl/outb/outw/outl support
Linux only supports the required ISA sysctls on StrongARM devices,
which are armv4 and no longer tested during glibc development
and probably bit-rotted by this point.  (No reported test results,
and the last discussion of armv4 support was in the glibc 2.19
release notes.)
2019-06-01 13:33:49 +02:00
Florian Weimer
0bb8f8c791 Linux: Add oddly-named arm syscalls to syscall-names.list
<asm/unistd.h> on arm defines the following macros:

#define __ARM_NR_breakpoint             (__ARM_NR_BASE+1)
#define __ARM_NR_cacheflush             (__ARM_NR_BASE+2)
#define __ARM_NR_usr26                  (__ARM_NR_BASE+3)
#define __ARM_NR_usr32                  (__ARM_NR_BASE+4)
#define __ARM_NR_set_tls                (__ARM_NR_BASE+5)
#define __ARM_NR_get_tls                (__ARM_NR_BASE+6)

These do not follow the regular __NR_* naming convention and
have so far been ignored by the syscall-names.list consistency
checks.  This commit adds these names to the file, preparing
for the availability of these names in the regular __NR_*
namespace.
2019-06-01 13:33:49 +02:00
Adhemerval Zanella
fbd6c928bb Remove unused get_clockfreq files
The patch 6e8ba7fd57 meant to remove the all get_clockfreq.c.  This
patch removes the missing files for sparcv9 and x86_64.

Checked against a build to x86_64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/get_clockfreq.c:
	Remove file.
	* sysdeps/unix/sysv/linux/x86_64/get_clockfreq.c: Likewise.
2019-05-29 10:26:30 -03:00
Joseph Myers
bee1f2c413 Add F_SEAL_FUTURE_WRITE from Linux 5.1 to bits/fcntl-linux.h.
This patch adds the new F_SEAL_FUTURE_WRITE constant from Linux 5.1 to
bits/fcntl-linux.h.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_GNU]
	(F_SEAL_FUTURE_WRITE): New macro.
2019-05-23 13:20:48 +00:00
Zack Weinberg
a053e87849
Remove support for PowerPC SPE extension (powerpc*-*-*gnuspe*).
GCC 9 dropped support for the SPE extensions to PowerPC, which means
powerpc*-*-*gnuspe* configurations are no longer buildable with that
compiler.  This ISA extension was peculiar to the “e500” line of
embedded PowerPC chips, which, as far as I can tell, are no longer
being manufactured, so I think we should follow suit.

This patch was developed by grepping for “e500”, “__SPE__”, and
“__NO_FPRS__”, and may not eliminate every vestige of SPE support.
Most uses of __NO_FPRS__ are left alone, as they are relevant to
normal embedded PowerPC with soft-float.

        * sysdeps/powerpc/preconfigure: Error out on powerpc-*-*gnuspe*
        host type.
        * scripts/build-many-glibcs.py: Remove powerpc-*-linux-gnuspe
        and powerpc-*-linux-gnuspe-e500v1 from list of build configurations.

        * sysdeps/powerpc/powerpc32/e500: Recursively delete.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/e500: Recursively delete.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/context-e500.h:
        Delete.

        * sysdeps/powerpc/fpu_control.h: Remove SPE variant.
        Issue an #error if used with a compiler in SPE-float mode.
        * sysdeps/powerpc/powerpc32/__longjmp_common.S
        * sysdeps/powerpc/powerpc32/setjmp_common.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:
        Remove code to preserve SPE register state.

        * sysdeps/unix/sysv/linux/powerpc/elision-lock.c
        * sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
        * sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
        Remove __SPE__ ifndefs.
2019-05-22 10:05:40 -04:00
Adhemerval Zanella
004e52febf sysvipc: Add missing bit of semtimedop s390 consolidation
This patch add the missing SEMTIMEDOP_IPC_ARGS definions on powerpc
and sparc ipc_priv.h.

Checked on powerpc64le-linux-gnu and with a build for sparc64-linux-gnu.

	* sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (SEMTIMEDOP_IPC_ARGS):
	New define.
	* sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
	(SEMTIMEDOP_IPC_ARGS): Likewise.
2019-05-21 10:43:10 -03:00
Adhemerval Zanella
236c18e568 sysvipc: Consolidate semtimedop s390
This patch consolidates the s390-32 semtimedop implementation by defining
a arch-specific SEMTIMEDOP_IPC_ARGS to rearrange the arguments expected
by s390 Linux kABI.  The idea is to avoid have multiples semtimedop
implementation changes for Linux v5.1 change to enable wire-up sysvipc
support.

Checked with a s390-linux-gnu and s390x-linux-gnu and checking that
resulting semtimedop objects did not change.

	* sysdeps/unix/sysv/linux/ipc_priv.h (SEMTIMEDOP_IPC_ARGS): New
	define.
	* sysdpes/unix/sysv/linux/s390/ipc_priv.h: New file.
	* sysdeps/unix/sysv/linux/s390/semtimedop.c: Remove file.
	* sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use
	SEMTIMEDOP_IPC_ARGS for calls with __NR_ipc.
2019-05-20 12:25:31 -03:00
Adhemerval Zanella
dfba907fed sysvipc: Fix compat msgctl (BZ#24570)
The __IPC64 flags is meant to be used to enable the new sysv struct
format when the architectures supports it (ARCH_WANT_IPC_PARSE_VERSION
config flag on Linux kernel).

This currently issue only affects alpha.

	[BZ #24570]
	* sysdeps/unix/sysv/linux/msgctl.c (__old_msgctl): Remove __IPC_64
	usage.
2019-05-20 12:25:28 -03:00
Joseph Myers
5f161b2398 Update kernel-features.h files for Linux 5.1.
Linux 5.1 adds missing syscalls to the syscall table for many Linux
kernel architectures.  This patch updates the kernel-features.h
headers accordingly.  __ASSUME_DIRECT_SYSVIPC_SYSCALLS is not updated
because of the differences between new and old syscalls described in
<https://sourceware.org/ml/libc-alpha/2019-05/msg00235.html>.  The
statfs64 structure used by alpha matches what the new kernel syscalls
use.

Tested with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_STATFS64): Only undefine if [__LINUX_KERNEL_VERSION <
	0x050100].
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h (__ASSUME_STATX):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	(__ASSUME_STATX): Likewise.
2019-05-16 20:03:39 +00:00
Florian Weimer
04b261bdc1 Linux: Add the tgkill function
The tgkill function is sometimes used in crash handlers.

<bits/signal_ext.h> follows the same approach as <bits/unistd_ext.h>
(which was added for the gettid system call wrapper).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-05-14 22:55:51 +02:00
Adhemerval Zanella
c50e1c263e x86: Remove arch-specific low level lock implementation
This patch removes the arch-specific x86 assembly implementation for
low level locking and consolidate both 64 bits and 32 bits in a
single implementation.

Different than other architectures, x86 lll_trylock, lll_lock, and
lll_unlock implements a single-thread optimization to avoid atomic
operation, using cmpxchgl instead.  This patch implements by using
the new single-thread.h definitions in a generic way, although using
the previous semantic.

The lll_cond_trylock, lll_cond_lock, and lll_timedlock just use
atomic operations plus calls to lll_lock_wait*.

For __lll_lock_wait_private and __lll_lock_wait the generic implemtation
there is no indication that assembly implementation is required
performance-wise.

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

	* sysdeps/nptl/lowlevellock.h (__lll_trylock): New macro.
	(lll_trylock): Call __lll_trylock.
	* sysdeps/unix/sysv/linux/i386/libc-lowlevellock.S: Remove file.
	* sysdeps/unix/sysv/linux/i386/lll_timedlock_wait.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/lll_timedlock_wait.c: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/lowlevellock.h: New file.
	* sysdeps/unix/sysv/linux/x86_64/cancellation.S: Include
	lowlevellock-futex.h.
2019-05-14 08:48:02 -03:00
Adhemerval Zanella
fdb8a0be9b Add single-thread.h header
This patch move the single-thread syscall optimization defintions from
syscall-cancel.h to new header file single-thread.h and also move the
cancellation definitions from pthreadP.h to syscall-cancel.h.

The idea is just simplify the inclusion of both syscall-cancel.h and
single-thread.h (without the requirement of including all pthreadP.h
defintions).

No semantic changes expected, checked on a build for all major ABIs.

	* nptl/pthreadP.h (CANCEL_ASYNC, CANCEL_RESET, LIBC_CANCEL_ASYNC,
	LIBC_CANCEL_RESET, __libc_enable_asynccancel,
	__libc_disable_asynccancel, __librt_enable_asynccancel,
	__libc_disable_asynccancel, __librt_enable_asynccancel,
	__librt_disable_asynccancel): Move to ...
	* sysdeps/unix/sysv/linux/sysdep-cancel.h: ... here.
	(SINGLE_THREAD_P, RTLD_SINGLE_THREAD_P): Move to ...
	* sysdeps/unix/sysv/linux/single-thread.h: ... here.
	* sysdeps/generic/single-thread.h: New file.
	* sysdeps/unix/sysdep.h: Include single-thread.h.
	* sysdeps/unix/sysv/linux/futex-internal.h: Include sysdep-cancel.h.
	* sysdeps/unix/sysv/linux/lowlevellock-futex.h: Likewise.
2019-05-14 08:41:15 -03:00
Joseph Myers
7621676f7a Update syscall-names.list for Linux 5.1.
This patch updates syscall-names.list for Linux 5.1 (which has many
new syscalls, mainly but not entirely ones for 64-bit time).

Tested with build-many-glibcs.py (before the revert of the move to
Linux 5.1 there; verified there were no tst-syscall-list failures).

	* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
	version to 5.1.
	(clock_adjtime64) New syscall.
	(clock_getres_time64) Likewise.
	(clock_gettime64) Likewise.
	(clock_nanosleep_time64) Likewise.
	(clock_settime64) Likewise.
	(futex_time64) Likewise.
	(io_pgetevents_time64) Likewise.
	(io_uring_enter) Likewise.
	(io_uring_register) Likewise.
	(io_uring_setup) Likewise.
	(mq_timedreceive_time64) Likewise.
	(mq_timedsend_time64) Likewise.
	(pidfd_send_signal) Likewise.
	(ppoll_time64) Likewise.
	(pselect6_time64) Likewise.
	(recvmmsg_time64) Likewise.
	(rt_sigtimedwait_time64) Likewise.
	(sched_rr_get_interval_time64) Likewise.
	(semtimedop_time64) Likewise.
	(timer_gettime64) Likewise.
	(timer_settime64) Likewise.
	(timerfd_gettime64) Likewise.
	(timerfd_settime64) Likewise.
	(utimensat_time64) Likewise.
2019-05-07 23:57:26 +00:00
Florian Weimer
7b807a35a8 misc: Add twalk_r function
The twalk function is very difficult to use in a multi-threaded
program because there is no way to pass external state to the
iterator function.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-05-02 11:42:51 +02:00
Adhemerval Zanella
a3ae315a8f mips: Remove rt_sigreturn usage on context function
Similar to powerpc, mips also issues rt_sigreturn for setcontext
case the v0 value saved is not the one set by setcontext or
makecontext. As for powerpc, it is intention is no really supported
since setcontext is not async-signal-safe.

Checked the context tests on mips64-linux-gnu and mips-linux-gnu.

	* sysdeps/unix/sysv/linux/mips/getcontext.S (__getcontext): Remove
	the magic flag store.
	* sysdeps/unix/sysv/linux/mips/makecontext.S (__makecontext):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/swapcontext.S (__swapcontext):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/setcontext.S (__setcontext):
	Remove rt_sigreturn call.
2019-04-17 15:14:45 -03:00
Adhemerval Zanella
ffe8a9a831 powerpc: Remove rt_sigreturn usage on context function
As described in a recent glibc thread [1], the rt_sigreturn syscall
on setcontext and swapcontext is not used on default use and its
intention is no really supported since neither setcontext nor
swapcontext are async-signal-safe.

Checked on powerpc64-linux-gnu and powerpc-linux-gnu.

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S:
	Remove rt_sigreturn call.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S: Likewie.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S: Likewise.

[1] https://sourceware.org/ml/libc-alpha/2019-02/msg00367.html
2019-04-17 15:14:41 -03:00
Richard Henderson
d5ecee822e alpha: Do not redefine __NR_shmat or __NR_osf_shmat
Fixes build using v5.1-rc1 headers.

The kernel has cleaned up how these are defined.  Previous behavior
was to define __NR_osf_shmat as 209 and not define __NR_shmat.
Current behavior is to define __NR_shmat as 209 and then define
__NR_osf_shmat as __NR_shmat.

	* sysdeps/unix/sysv/linux/alpha/kernel-features.h (__NR_shmat):
	Do not redefine.
	* sysdeps/unix/sysv/linux/alpha/sysdep.h (__NR_osf_shmat):
	Do not redefine.
2019-04-01 15:54:00 +07:00
Maciej W. Rozycki
656dd306d4 RISC-V: Fix `test' operand error with soft-float ABI being configured
Fix a:

.../sysdeps/unix/sysv/linux/riscv/configure: line 181: test: =: unary operator expected

message produced by the RISC-V configure fragment with the soft-float
ABI selected, caused by $libc_cv_riscv_float_abi evaluating to nil in
the invocation of `test $libc_cv_riscv_float_abi = no'.

	* sysdeps/unix/sysv/linux/riscv/configure.ac: Quote
	$libc_cv_riscv_float_abi in `test' invocation.
	* sysdeps/unix/sysv/linux/riscv/configure: Regenerate.
2019-03-30 01:11:31 +00:00
Adhemerval Zanella
6e8ba7fd57 Remove __get_clockfreq
With clock_getres, clock_gettime, and clock_settime refactor to remove the
generic CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID support through
hp-timing, there is no usage of internal __get_clockfreq.  This patch removes
both generic and Linux implementation..

Checked with a build against aarch64-linux-gnu, i686-linux-gnu, ia64-linux-gnu,
sparc64-linux-gnu, powerpc-linux-gnu-power4.

	* include/libc-internal.h (__get_clockfreq): Remove prototype.
	* rt/Makefile (clock-routines): Remove get_clockfreq.
	* rt/get_clockfreq.c: Remove file.
	* sysdeps/unix/sysv/linux/i386/get_clockfreq.c: Likewise.
	* sysdeps/unix/sysv/linux/ia64/get_clockfreq.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Move code to ...
	* sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c: ... here.
2019-03-22 16:52:29 -03:00
Adhemerval Zanella
77b6f55347 linux: Assume clock_getres CLOCK_{PROCESS,THREAD}_CPUTIME_ID
The Linux 3.2 clock_getres kernel code (kernel/posix-cpu-timers.c)
issued for clock_getres CLOCK_PROCESS_CPUTIME_ID (process_cpu_clock_getres)
and CLOCK_THREAD_CPUTIME_ID (thread_cpu_clock_getres) call
posix_cpu_clock_getres. And it fails on check_clock only if an invalid
clock is used (not the case) or if we pass an invalid the pid/tid in
29 msb of clock_id (not the case either).

This patch assumes that clock_getres syscall always support
CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID, so there is no need
to fallback to hp-timing support for _SC_MONOTONIC_CLOCK neither to issue
the syscall to certify the clock_id is supported bt the kernel.  This
allows simplify the sysconf support to always use the syscall.

it also removes ia64 itc drift check and assume kernel handles it correctly.

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

	* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c: Remove file.
	* sysdeps/unix/sysv/linux/ia64/sysconf.c: Likewise.
	* sysdeps/unix/sysv/linux/sysconf.c (has_cpuclock): Remove function.
	(__sysconf): Assume kernel support for _SC_MONOTONIC_CLOCK,
	_SC_CPUTIME, and _SC_THREAD_CPUTIME.
2019-03-22 16:52:29 -03:00
Adhemerval Zanella
38cc11daa4 nptl: Remove pthread_clock_gettime pthread_clock_settime
This patch removes CLOCK_THREAD_CPUTIME_ID and CLOCK_PROCESS_CPUTIME_ID support
from clock_gettime and clock_settime generic implementation.  For Linux, kernel
already provides supports through the syscall and Hurd HTL lacks
__pthread_clock_gettime and __pthread_clock_settime internal implementation.

As described in clock_gettime man-page [1] on 'Historical note for SMP
system', implementing CLOCK_{THREAD,PROCESS}_CPUTIME_ID with timer registers
is error-prone and susceptible to timing and accurary issues that the libc
can not deal without kernel support.

This allows removes unused code which, however, still incur in some runtime
overhead in thread creation (the struct pthread cpuclock_offset
initialization).

If hurd eventually wants to support them it should either either implement as
a kernel facility (or something related due its architecture) or in system
specific implementation.

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also
checked on a i686-gnu build.

	* nptl/Makefile (libpthread-routines): Remove pthread_clock_gettime and
	pthread_clock_settime.
	* nptl/pthreadP.h (__find_thread_by_id): Remove prototype.
	* elf/dl-support.c [!HP_TIMING_NOAVAIL] (_dl_cpuclock_offset): Remove.
	(_dl_non_dynamic_init): Remove _dl_cpuclock_offset setting.
	* elf/rtld.c (_dl_start_final): Likewise.
	* nptl/allocatestack.c (__find_thread_by_id): Remove function.
	* sysdeps/generic/ldsodefs.h [!HP_TIMING_NOAVAIL] (_dl_cpuclock_offset):
	Remove.
	* sysdeps/mach/hurd/dl-sysdep.c [!HP_TIMING_NOAVAIL]
	(_dl_cpuclock_offset): Remove.
	* nptl/descr.h (struct pthread): Rename cpuclock_offset to
	cpuclock_offset_ununsed.
	* nptl/nptl-init.c (__pthread_initialize_minimal_internal): Remove
	cpuclock_offset set.
	* nptl/pthread_create.c (START_THREAD_DEFN): Likewise.
	* sysdeps/nptl/fork.c (__libc_fork): Likewise.
	* nptl/pthread_clock_gettime.c: Remove file.
	* nptl/pthread_clock_settime.c: Likewise.
	* sysdeps/unix/clock_gettime.c (hp_timing_gettime): Remove function.
	[HP_TIMING_AVAIL] (realtime_gettime): Remove CLOCK_THREAD_CPUTIME_ID
	and CLOCK_PROCESS_CPUTIME_ID support.
	* sysdeps/unix/clock_settime.c (hp_timing_gettime): Likewise.
	[HP_TIMING_AVAIL] (realtime_gettime): Likewise.
	* sysdeps/posix/clock_getres.c (hp_timing_getres): Likewise.
	[HP_TIMING_AVAIL] (__clock_getres): Likewise.
	* sysdeps/unix/clock_nanosleep.c (CPUCLOCK_P, INVALID_CLOCK_P):
	Likewise.
	(__clock_nanosleep): Remove CPUCLOCK_P and INVALID_CLOCK_P usage.

[1] http://man7.org/linux/man-pages/man2/clock_gettime.2.html
2019-03-22 15:37:43 -03:00
Stefan Liebler
1a7df49c92 S390: Add new hwcap values for new cpu architecture arch13.
The new hwcap values indicate support for:
-"Vector-Enhancements Facility 2" (tag "vxe2", hwcap 2^15)
-"Vector-Packed-Decimal-Enhancement Facility" (tag "vxp", hwcap 2^16)
-"Enhanced-Sort Facility" (tag "sort", hwcap 2^17)
-"Deflate-Conversion Facility" (tag "dflt", hwcap 2^18)

The vxe2 hwcap is also marked as important hwcap.

ChangeLog:

	* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags):
	Add vxe2, vxp, dflt, sort flags.
	* sysdeps/s390/dl-procinfo.h: Add HWCAP_S390_VXRS_EXT2,
	HWCAP_S390_VXRS_PDE, HWCAP_S390_SORT, HWCAP_S390_DFLT
	capabilities.
	(HWCAP_IMPORTANT): Add HWCAP_S390_VXRS_EXT2.
	* sysdeps/unix/sysv/linux/s390/bits/hwcap.h
	(HWCAP_S390_VXRS_EXT2, HWCAP_S390_VXRS_PDE, HWCAP_S390_SORT,
	HWCAP_S390_DFLT): Define.
2019-03-22 11:14:07 +01:00
Joseph Myers
a2e57f89a3 Add AArch64 HWCAPs from Linux 5.0.
This patch adds new AArch64 HWCAPs from Linux 5.0 to the AArch64
bits/hwcap.h and dl-procinfo.c.

Tested (compilation only) with build-many-glibcs.py for
aarch64-linux-gnu.

	* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_SB): New
	macro.
	(HWCAP_PACA): Likewise.
	(HWCAP_PACG): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c (_DL_HWCAP_COUNT):
	Increase to 32.
	(_dl_aarch64_cap_flags): Add new entries for new HWCAPs.
2019-03-19 14:02:17 +00:00
Joseph Myers
477e739b32 Update syscall-names.list for Linux 5.0.
This patch updates sysdeps/unix/sysv/linux/syscall-names.list for
Linux 5.0.  Based on testing with build-many-glibcs.py, the only new
entry needed is for old_getpagesize (a newly added __NR_* name for an
old syscall on ia64).  (Because 5.0 changes how syscall tables are
handled in the kernel, checking diffs wasn't a useful way of looking
for new syscalls in 5.0 as most of the syscall tables were moved to
the new representation without actually adding any syscalls to them.)

Tested with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
	version to 5.0.
	(old_getpagesize): New syscall.
2019-03-15 18:18:40 +00:00
Florian Weimer
a0a0dc8317 Remove obsolete, never-implemented XSI STREAMS declarations
The stub implementations are turned into compat symbols.

Linux actually has two reserved system call numbers (for getpmsg
and putpmsg), but these system calls have never been implemented,
and there are no plans to implement them, so this patch replaces
the wrappers with the generic stubs.

According to <https://bugzilla.redhat.com/show_bug.cgi?id=436349>,
the presence of the XSI STREAMS declarations is a minor portability
hazard because they are not actually implemented.

This commit does not change the TIRPC support code in
sunrpc/rpc_svcout.c.  It uses additional XTI functionality and
therefore never worked with glibc.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-03-14 15:44:15 +01:00
Stefan Liebler
7c6513082b Fix output of LD_SHOW_AUXV=1.
Starting with commit 1616d034b6
the output was corrupted on some platforms as _dl_procinfo
was called for every auxv entry and on some architectures like s390
all entries were represented as "AT_HWCAP".

This patch is removing the condition and let _dl_procinfo decide if
an entry is printed in a platform specific or generic way.
This patch also adjusts all _dl_procinfo implementations which assumed
that they are only called for AT_HWCAP or AT_HWCAP2. They are now just
returning a non-zero-value for entries which are not handled platform
specifc.

ChangeLog:

	* elf/dl-sysdep.c (_dl_show_auxv): Remove condition and always
	call _dl_procinfo.
	* sysdeps/unix/sysv/linux/s390/dl-procinfo.h (_dl_procinfo):
	Ignore types other than AT_HWCAP.
	* sysdeps/sparc/dl-procinfo.h (_dl_procinfo): Likewise.
	* sysdeps/unix/sysv/linux/i386/dl-procinfo.h (_dl_procinfo):
	Likewise.
	* sysdeps/powerpc/dl-procinfo.h (_dl_procinfo): Adjust comment
	in the case of falling back to generic output mechanism.
	* sysdeps/unix/sysv/linux/arm/dl-procinfo.h (_dl_procinfo):
	Likewise.
2019-03-13 10:45:35 +01:00
Mao Han
c4e5f34bf0 C-SKY: mark lr as undefined to stop unwinding
Mark the lr register as undefined at the start of execution, so unwind
will stop at this frame. run-backtrace-*.sh from elfutils testsuite will
fail without this patch.

	* sysdeps/csky/abiv2/start.S: Mark lr as undefined.
	* sysdeps/unix/sysv/linux/csky/abiv2/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S: Likewise.
2019-03-11 09:51:14 +08:00
Mao Han
827e30f3a3 C-SKY: remove user_regs definition
C-SKY GDB dose not use this file for ptrace and coredump.  ptrace can use
pt_regs definition from linux kernel directly.  The old definition only
got 34 regs instead of 38 regs from linux kernel, which will corrupted
the memory after ptrace PTRACE_GETREGSET call.

	* sysdeps/unix/sysv/linux/csky/sys/procfs.h: Use linux definition
	directly.
	* sysdeps/unix/sysv/linux/csky/sys/user.h: Remove user_regs
	definition.
2019-03-11 09:48:51 +08:00
Mao Han
6229c9bff7 C-SKY: fix sigcontext miss match
C-SKY defines SIGCONTEXT as siginfo_t *_si, struct ucontext_t * for
__profil_counter.  ucontext_t get an extra __mask field which is miss
match with the struct sigcontext from linux kernel.  The time value
from gprof report will be always zero without this patch.  This
patch also fix the registers sequence in register-dump.h.

	* sysdeps/unix/sysv/linux/csky/register-dump.h: Adjust offset change.
	* sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Remove __mask field
	in mcontext_t
2019-03-11 09:45:15 +08:00
Joseph Myers
c5f65462a2 Break lines before not after operators, batch 4.
This patch fixes further coding style issues where code should have
broken lines before operators in accordance with the GNU Coding
Standards but instead was breaking lines after them.

Tested for x86_64, and with build-many-glibcs.py.

	* stdio-common/vfscanf-internal.c (ARG): Break lines before rather
	than after operators.
	* sysdeps/mach/hurd/setitimer.c (timer_thread): Likewise.
	(setitimer_locked): Likewise.
	* sysdeps/mach/hurd/sigaction.c (__sigaction): Likewise.
	* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
	* sysdeps/mach/pagecopy.h (PAGE_COPY_FWD): Likewise.
	* sysdeps/mach/thread_state.h (machine_get_basic_state): Likewise.
	* sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c
	(PPC_CPU_SUPPORTED): Likewise.
	* sysdeps/unix/sysv/linux/alpha/a.out.h (N_TXTOFF): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
	(stat_overflow): Likewise.
	(statfs_overflow): Likewise.
	* sysdeps/unix/sysv/linux/tst-personality.c (do_test): Likewise.
	* sysdeps/unix/sysv/linux/tst-ttyname.c (eq_ttyname): Likewise.
	(eq_ttyname_r): Likewise.
	(run_chroot_tests): Likewise.
2019-03-07 20:20:25 +00:00
Adhemerval Zanella
0ddb7ea842 nptl: Assume __ASSUME_FUTEX_CLOCK_REALTIME support
This patch assumes realtime clock support for nptl and thus removes
all the associated code.

For __pthread_mutex_timedlock the fallback usage for the case where
lll_futex_timed_wait_bitset it not set define is also removed. The
generic lowlevellock-futex.h always define it, so for NPTL code the
check always yield true.

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

	* nptl/nptl-init.c (__have_futex_clock_realtime,
	__have_futex_clock_realtime): Remove definition.
	(__pthread_initialize_minimal_internal): Remove FUTEX_CLOCK_REALTIME
	check test for !__ASSUME_FUTEX_CLOCK_REALTIME.
	* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Assume
	__ASSUME_FUTEX_CLOCK_REALTIME support.
	* sysdeps/unix/sysv/linux/i386/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_FUTEX_CLOCK_REALTIME): Remove.
	* sysdeps/nptl/lowlevellock-futex.h (lll_futex_timed_wait_bitset):
	Adjust comment.
2019-03-05 16:28:20 -03:00
Gabriel F. T. Gomes
d11086a939 ldbl-opt: Add error and error_at_line (bug 23984)
On platforms where long double may have the same format as double
(-mlong-double-64), error and error_at_line do not take that into
account and might produce wrong output if a long double conversion is
requested by the format string ('%Lf').  This patch adds compatibility
functions for this situation and redirects calls via header magic.

Tested for powerpc, powerpc64 and powerpc64le.
2019-03-01 15:26:36 -03:00
Gabriel F. T. Gomes
90188e7d1a ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984)
When support for long double format with 128-bits (-mlong-double-128)
was added for platforms where long double had the same format as double,
such as powerpc, compatibility versions for the functions listed in the
commit title were missed.  Since the older format of long double can
still be used (with -mlong-double-64), using these functions with a
format string that requests the printing of long double variables will
produce wrong outputs.

This patch adds the missing compatibility functions and header magic to
redirect calls to them when -mlong-double-64 is in use.

Tested for powerpc, powerpc64 and powerpc64le.
2019-03-01 15:24:51 -03:00
Gabriel F. T. Gomes
6e1f6440b9 ldbl-opt: Add argp_error and argp_failure (bug 23983)
The functions argp_error and argp_failure are missing support for
printing long double values when long double has the same format as
double.  This patch adds the new functions __nldbl_argp_error and
__nldbl_argp_failure, as well as header magic to redirect calls to them
when -mlong-double-64 is in use.

Tested for powerpc, powerpc64 and powerpc64le.
2019-03-01 15:21:32 -03:00
Florian Weimer
36f30c104f __netlink_assert_response: Add more __libc_fatal newlines [BZ #20271]
Commit a6e8926f8d ("[BZ #20271] Add
newlines in __libc_fatal calls.") missed two places that need
changing.
2019-03-01 12:21:53 +01:00
Joseph Myers
462e83a4a0 Add more spaces before '('.
This patch fixes more places where a space should have been present
before '(' in accordance with the GNU Coding Standards (as with the
previous patch, mainly for calls to sizeof).

Tested with build-many-glibcs.py.

	* sysdeps/powerpc/powerpc32/dl-machine.c
	(__elf_machine_fixup_plt): Use space before '('.
	(__process_machine_rela): Likewise.
	* sysdeps/powerpc/powerpc32/register-dump.h (register_dump):
	Likewise.
	* sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h (TI_BITS):
	Likewise.
	* sysdeps/powerpc/powerpc64/register-dump.h (register_dump):
	Likewise.
	* sysdeps/powerpc/test-arith.c (union_t): Likewise.
	(pattern): Likewise.
	(delta): Likewise.
	(check_result): Likewise.
	(check_excepts): Likewise.
	(check_op): Likewise.
	(fail_xr): Likewise.
	* sysdeps/unix/alpha/sysdep.h (syscall_promote): Likewise.
	* sysdeps/unix/sysv/linux/alpha/a.out.h (AOUTHSZ): Likewise.
	(SCNHSZ): Likewise.
	* sysdeps/unix/sysv/linux/hppa/makecontext.c (FRAME_SIZE_BYTES):
	Likewise.
	(ARGS): Likewise.
	(__makecontext): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (ucontext_t):
	Likewise.
2019-02-28 15:02:09 +00:00
Samuel Thibault
1b21841775 hurd: Add renameat2 support for RENAME_NOREPLACE
* include/stdio.h (__renameat2): New hidden prototype.
	* stdio-common/renameat2.c (__renameat2): Add hidden definition.
	* sysdeps/mach/hurd/renameat.c (__renameat): Move implementation to...
	* sysdeps/mach/hurd/renameat2.c (__renameat2): ... new function, and
	add support for RENAME_NOREPLACE.
	* sysdeps/unix/sysv/linux/renameat2.c (__renameat2): Add hidden definition.
2019-02-27 09:42:44 -08:00
Joseph Myers
c4f50205e1 Add some spaces before '('.
This patch fixes various places where a space should have been present
before '(' in accordance with the GNU Coding Standards.  Most but not
all of the fixes in this patch are for calls to sizeof (but it's not
exhaustive regarding such calls that should be fixed).

Tested for x86_64, and with build-many-glibcs.py.

	* benchtests/bench-strcpy.c (do_test): Use space before '('.
	* benchtests/bench-string.h (cmdline_process_function): Likewise.
	* benchtests/bench-strlen.c (do_test): Likewise.
	(test_main): Likewise.
	* catgets/gencat.c (read_old): Likewise.
	* elf/cache.c (load_aux_cache): Likewise.
	* iconvdata/bug-iconv8.c (do_test): Likewise.
	* math/test-tgmath-ret.c (do_test): Likewise.
	* nis/nis_call.c (rec_dirsearch): Likewise.
	* nis/nis_findserv.c (__nis_findfastest_with_timeout): Likewise.
	* nptl/tst-audit-threads.c (do_test): Likewise.
	* nptl/tst-cancel4-common.h (set_socket_buffer): Likewise.
	* nss/nss_test1.c (init): Likewise.
	* nss/test-netdb.c (test_hosts): Likewise.
	* posix/execvpe.c (maybe_script_execute): Likewise.
	* stdio-common/tst-fmemopen4.c (do_test): Likewise.
	* stdio-common/tst-printf.c (do_test): Likewise.
	* stdio-common/vfscanf-internal.c (__vfscanf_internal): Likewise.
	* stdlib/fmtmsg.c (NKEYWORDS): Likewise.
	* stdlib/qsort.c (STACK_SIZE): Likewise.
	* stdlib/test-canon.c (do_test): Likewise.
	* stdlib/tst-swapcontext1.c (do_test): Likewise.
	* string/memcmp.c (OPSIZ): Likewise.
	* string/test-strcpy.c (do_test): Likewise.
	(do_random_tests): Likewise.
	* string/test-strlen.c (do_test): Likewise.
	(test_main): Likewise.
	* string/test-strrchr.c (do_test): Likewise.
	(do_random_tests): Likewise.
	* string/tester.c (test_memrchr): Likewise.
	(test_memchr): Likewise.
	* sysdeps/generic/memcopy.h (OPSIZ): Likewise.
	* sysdeps/generic/unwind-dw2.c (execute_stack_op): Likewise.
	* sysdeps/generic/unwind-pe.h (read_sleb128): Likewise.
	(read_encoded_value_with_base): Likewise.
	* sysdeps/hppa/dl-machine.h (elf_machine_runtime_setup): Likewise.
	* sysdeps/hppa/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/ia64/fpu/sfp-machine.h (TI_BITS): Likewise.
	* sysdeps/mach/hurd/spawni.c (__spawni): Likewise.
	* sysdeps/posix/spawni.c (maybe_script_execute): Likewise.
	* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c (query_auxv):
	Likewise.
	* sysdeps/unix/sysv/linux/aarch64/bits/procfs.h (ELF_NGREG):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/bits/procfs.h (ELF_NGREG): Likewise.
	* sysdeps/unix/sysv/linux/arm/ioperm.c (init_iosys): Likewise.
	* sysdeps/unix/sysv/linux/csky/bits/procfs.h (ELF_NGREG):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/procfs.h (ELF_NGREG):
	Likewise.
	* sysdeps/unix/sysv/linux/nios2/bits/procfs.h (ELF_NGREG):
	Likewise.
	* sysdeps/unix/sysv/linux/spawni.c (maybe_script_execute):
	Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/procfs.h (ELF_NGREG): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/sigcontext.h
	(FP_XSTATE_MAGIC2_SIZE): Likewise.
	* sysdeps/x86/fpu/sfp-machine.h (TI_BITS): Likewise.
	* time/test_time.c (main): Likewise.
2019-02-27 13:55:45 +00:00
Joseph Myers
aa0e46636a Break further lines before not after operators.
This patch continues the process of fixing coding style to break lines
before not after operators in accordance with the GNU Coding
Standards, fixing such issues in a non-exhaustive selection of sysdeps
files that had them.

Tested for x86_64, and with build-many-glibcs.py.

	* sysdeps/arm/sysdep.h (#if condition): Break lines before rather
	than after operators.
	* sysdeps/mach/hurd/fork.c (__fork): Likewise.
	* sysdeps/mach/hurd/getcwd.c
	(__hurd_canonicalize_directory_name_internal): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-consistent.c
	(pthread_mutex_consistent): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-init.c (_pthread_mutex_init):
	Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c
	(__pthread_mutex_transfer_np): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-unlock.c
	(__pthread_mutex_unlock): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex.h (ROBUST_LOCK): Likewise.
	(mtx_owned_p): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-getrobust.c
	(pthread_mutexattr_getrobust): Likewise.
	* sysdeps/mach/hurd/i386/init-first.c (init1): Likewise.
	* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler):
	Likewise.
	* sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
	* sysdeps/mach/hurd/jmp-unwind.c (_longjmp_unwind): Likewise.
	* sysdeps/mach/hurd/kill.c (__kill): Likewise.
	* sysdeps/mach/hurd/mig-reply.c (__mig_get_reply_port): Likewise.
	* sysdeps/mach/hurd/ptrace.c (ptrace): Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sysdep.h (#if condition):
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/ioperm.c (process_cpuinfo):
	Likewise.
	* sysdeps/unix/sysv/linux/bits/timex.h (STA_RONLY): Likewise.
	* sysdeps/unix/sysv/linux/csky/sysdep.h (#if condition): Likewise.
	* sysdeps/unix/sysv/linux/generic/____longjmp_chk.c
	(____longjmp_chk): Likewise.
	* sysdeps/unix/sysv/linux/generic/futimesat.c (futimesat):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
	(INTERNAL_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
	(INTERNAL_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c
	(__get_clockfreq_via_cpuinfo): Likewise.
2019-02-26 15:01:50 +00:00
Joseph Myers
a04549c194 Break more lines before not after operators.
This patch makes further coding style fixes where code was breaking
lines after an operator, contrary to the GNU Coding Standards.  As
with the previous patch, it is limited to files following a reasonable
approximation to GNU style already, and is not exhaustive; more such
issues remain to be fixed.

Tested for x86_64, and with build-many-glibcs.py.

	* dirent/dirent.h [!_DIRENT_HAVE_D_NAMLEN
	&& _DIRENT_HAVE_D_RECLEN] (_D_ALLOC_NAMLEN): Break lines before
	rather than after operators.
	* elf/cache.c (print_cache): Likewise.
	* gshadow/fgetsgent_r.c (__fgetsgent_r): Likewise.
	* htl/pt-getattr.c (__pthread_getattr_np): Likewise.
	* hurd/hurdinit.c (_hurd_setproc): Likewise.
	* hurd/hurdkill.c (_hurd_sig_post): Likewise.
	* hurd/hurdlookup.c (__file_name_lookup_under): Likewise.
	* hurd/hurdsig.c (_hurd_internal_post_signal): Likewise.
	(reauth_proc): Likewise.
	* hurd/lookup-at.c (__file_name_lookup_at): Likewise.
	(__file_name_split_at): Likewise.
	(__directory_name_split_at): Likewise.
	* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Likewise.
	* hurd/port2fd.c (_hurd_port2fd): Likewise.
	* iconv/gconv_dl.c (do_print): Likewise.
	* inet/netinet/in.h (struct sockaddr_in): Likewise.
	* libio/wstrops.c (_IO_wstr_seekoff): Likewise.
	* locale/setlocale.c (new_composite_name): Likewise.
	* malloc/memusagestat.c (main): Likewise.
	* misc/fstab.c (fstab_convert): Likewise.
	* nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
	Likewise.
	* nss/nss_compat/compat-grp.c (getgrent_next_nss): Likewise.
	(getgrent_next_file): Likewise.
	(internal_getgrnam_r): Likewise.
	(internal_getgrgid_r): Likewise.
	* nss/nss_compat/compat-initgroups.c (getgrent_next_nss):
	Likewise.
	(internal_getgrent_r): Likewise.
	* nss/nss_compat/compat-pwd.c (getpwent_next_nss_netgr): Likewise.
	(getpwent_next_nss): Likewise.
	(getpwent_next_file): Likewise.
	(internal_getpwnam_r): Likewise.
	(internal_getpwuid_r): Likewise.
	* nss/nss_compat/compat-spwd.c (getspent_next_nss_netgr):
	Likewise.
	(getspent_next_nss): Likewise.
	(internal_getspnam_r): Likewise.
	* pwd/fgetpwent_r.c (__fgetpwent_r): Likewise.
	* shadow/fgetspent_r.c (__fgetspent_r): Likewise.
	* string/strchr.c (STRCHR): Likewise.
	* string/strchrnul.c (STRCHRNUL): Likewise.
	* sysdeps/aarch64/fpu/fpu_control.h (_FPU_FPCR_IEEE): Likewise.
	* sysdeps/aarch64/sfp-machine.h (_FP_CHOOSENAN): Likewise.
	* sysdeps/csky/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/generic/memcopy.h (PAGE_COPY_FWD_MAYBE): Likewise.
	* sysdeps/generic/symbol-hacks.h (__stack_chk_fail_local):
	Likewise.
	* sysdeps/gnu/netinet/ip_icmp.h (ICMP_INFOTYPE): Likewise.
	* sysdeps/gnu/updwtmp.c (TRANSFORM_UTMP_FILE_NAME): Likewise.
	* sysdeps/gnu/utmp_file.c (TRANSFORM_UTMP_FILE_NAME): Likewise.
	* sysdeps/hppa/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/mach/hurd/bits/stat.h (S_ISPARE): Likewise.
	* sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_start): Likewise.
	(open_file): Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-setprotocol.c
	(pthread_mutexattr_setprotocol): Likewise.
	* sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
	* sysdeps/mach/hurd/mmap.c (__mmap): Likewise.
	* sysdeps/mach/hurd/ptrace.c (ptrace): Likewise.
	* sysdeps/mach/hurd/spawni.c (__spawni): Likewise.
	* sysdeps/microblaze/dl-machine.h (elf_machine_type_class):
	Likewise.
	(elf_machine_rela): Likewise.
	* sysdeps/mips/mips32/sfp-machine.h (_FP_CHOOSENAN): Likewise.
	* sysdeps/mips/mips64/sfp-machine.h (_FP_CHOOSENAN): Likewise.
	* sysdeps/mips/sys/asm.h (multiple #if conditionals): Likewise.
	* sysdeps/posix/rename.c (rename): Likewise.
	* sysdeps/powerpc/novmx-sigjmp.c (__novmx__sigjmp_save): Likewise.
	* sysdeps/powerpc/sigjmp.c (__vmx__sigjmp_save): Likewise.
	* sysdeps/s390/fpu/fenv_libc.h (FPC_VALID_MASK): Likewise.
	* sysdeps/s390/utf8-utf16-z9.c (gconv_end): Likewise.
	* sysdeps/unix/grantpt.c (grantpt): Likewise.
	* sysdeps/unix/sysv/linux/a.out.h (N_TXTOFF): Likewise.
	* sysdeps/unix/sysv/linux/updwtmp.c (TRANSFORM_UTMP_FILE_NAME):
	Likewise.
	* sysdeps/unix/sysv/linux/utmp_file.c (TRANSFORM_UTMP_FILE_NAME):
	Likewise.
	* sysdeps/x86/cpu-features.c (get_common_indices): Likewise.
	* time/tzfile.c (__tzfile_compute): Likewise.
2019-02-25 13:19:19 +00:00
Stefan Liebler
6c29942cbf misc/tst-clone3: Fix waiting for exited thread.
From time to time the test misc/tst-clone3 fails with a timeout.
Then futex_wait is blocking.  Usually ctid should be set to zero
due to CLONE_CHILD_CLEARTID and the futex should be waken up.
But the fail occures if the thread has already exited before
ctid is set to the return value of clone().  Then futex_wait() will
block as there will be nobody who wakes the futex up again.

This patch initializes ctid to a known value before calling clone
and the kernel is the only one who updates the value to zero after clone.
If futex_wait is called then it is either waked up due to the exited thread
or the futex syscall fails as *ctid_ptr is already zero instead of the
specified value 1.

ChangeLog:

	* sysdeps/unix/sysv/linux/tst-clone3.c (do_test):
	Initialize ctid with a known value and remove update of ctid
	after clone.
	(wait_tid): Adjust arguments and call futex_wait with ctid_val
	as assumed current value of ctid_ptr.
2019-02-18 16:12:01 +01:00
Adhemerval Zanella
e442e40de5 io: Consolidate lockf implementation
With internal fcntl64 internal (commit 06ab719d), it is possible to
consolidate lockf implementation by using the LFS fcntl interface
instead of using arch and system-specific implementations.

For Linux, the i386 implementation is used as generic implementation
by replacing the direct syscall with fcntl64 call.  The LFS symbol
alias for default LFS ABI (__OFF_T_MATCHES_OFF64_T) is used to avoid
the duplicate symbol (instead of overriding the implementation with an
empty file).

For Hurd lockf64 semantic is changed: previous generic lockf64
implementation returned EOVERFLOW if LEN input is larger than 32-bit
off_t.  However, Hurd fcntl64 implementation for F_GETLK64, F_SETLK64,
and F_SETLKW64 do accept off64_t inputs (__f_setlk accepts only off64_t
inputs).

Checked on i686-linux-gnu and x86_64-linux-gnu along with a i686-gnu
build.

	* io/Makefile (tests): Add tst-lockf.
	* io/lockf.c (lockf): Use __fcntl and only define for
	!__OFF_T_MATCHES_OFF64_T.
	* io/lockf64.c (__lockf64): Call __fcntl64 and alias to lockf for
	__OFF_T_MATCHES_OFF64_T case.
	* io/tst-lockf.c: New file.
	* sysdeps/unix/sysv/linux/i386/lockf64.c: Remove file.
	* sysdeps/unix/sysv/linux/arm/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/lockf64.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/lockf64.c: Likewise.
2019-02-15 18:45:39 -02:00