about summary refs log tree commit diff
path: root/sysdeps/unix
Commit message (Collapse)AuthorAgeFilesLines
* Suppress internal declarations for most of the testsuite.Zack Weinberg2017-05-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new build module called 'testsuite'. IS_IN (testsuite) implies _ISOMAC, as do IS_IN_build and __cplusplus (which means several ad-hoc tests for __cplusplus can go away). libc-symbols.h now suppresses almost all of *itself* when _ISOMAC is defined; in particular, _ISOMAC mode does not get config.h automatically anymore. There are still quite a few tests that need to see internal gunk of one variety or another. For them, we now have 'tests-internal' and 'test-internal-extras'; files in this category will still be compiled with MODULE_NAME=nonlib, and everything proceeds as it always has. The bulk of this patch is moving tests from 'tests' to 'tests-internal'. There is also 'tests-static-internal', which has the same effect on files in 'tests-static', and 'modules-names-tests', which has the *inverse* effect on files in 'modules-names' (it's inverted because most of the things in modules-names are *not* tests). For both of these, the file must appear in *both* the new variable and the old one. There is also now a special case for when libc-symbols.h is included without MODULE_NAME being defined at all. (This happens during the creation of libc-modules.h, and also when preprocessing Versions files.) When this happens, IS_IN is set to be always false and _ISOMAC is *not* defined, which was the status quo, but now it's explicit. The remaining changes to C source files in this patch seemed likely to cause problems in the absence of the main change. They should be relatively self-explanatory. In a few cases I duplicated a definition from an internal header rather than move the test to tests-internal; this was a judgement call each time and I'm happy to change those however reviewers feel is more appropriate. * Makerules: New subdir configuration variables 'tests-internal' and 'test-internal-extras'. Test files in these categories will still be compiled with MODULE_NAME=nonlib. Test files in the existing categories (tests, xtests, test-srcs, test-extras) are now compiled with MODULE_NAME=testsuite. New subdir configuration variable 'modules-names-tests'. Files which are in both 'modules-names' and 'modules-names-tests' will be compiled with MODULE_NAME=testsuite instead of MODULE_NAME=extramodules. (gen-as-const-headers): Move to tests-internal. (do-tests-clean, common-mostlyclean): Support tests-internal. * Makeconfig (built-modules): Add testsuite. * Makefile: Change libof-check-installed-headers-c and libof-check-installed-headers-cxx to 'testsuite'. * Rules: Likewise. Support tests-internal. * benchtests/strcoll-inputs/filelist#en_US.UTF-8: Remove extra-modules.mk. * config.h.in: Don't check for __OPTIMIZE__ or __FAST_MATH__ here. * include/libc-symbols.h: Move definitions of _GNU_SOURCE, PASTE_NAME, PASTE_NAME1, IN_MODULE, IS_IN, and IS_IN_LIB to the very top of the file and rationalize their order. If MODULE_NAME is not defined at all, define IS_IN to always be false, and don't define _ISOMAC. If any of IS_IN (testsuite), IS_IN_build, or __cplusplus are true, define _ISOMAC and suppress everything else in this file, starting with the inclusion of config.h. Do check for inappropriate definitions of __OPTIMIZE__ and __FAST_MATH__ here, but only if _ISOMAC is not defined. Correct some out-of-date commentary. * include/math.h: If _ISOMAC is defined, undefine NO_LONG_DOUBLE and _Mlong_double_ before including math.h. * include/string.h: If _ISOMAC is defined, don't expose _STRING_ARCH_unaligned. Move a comment to a more appropriate location. * include/errno.h, include/stdio.h, include/stdlib.h, include/string.h * include/time.h, include/unistd.h, include/wchar.h: No need to check __cplusplus nor use __BEGIN_DECLS/__END_DECLS. * misc/sys/cdefs.h (__NTHNL): New macro. * sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__m81_defun): Use __NTHNL to avoid errors with GCC 6. * elf/tst-env-setuid-tunables.c: Include config.h with _LIBC defined, for HAVE_TUNABLES. * inet/tst-checks-posix.c: No need to define _ISOMAC. * intl/tst-gettext2.c: Provide own definition of N_. * math/test-signgam-finite-c99.c: No need to define _ISOMAC. * math/test-signgam-main.c: No need to define _ISOMAC. * stdlib/tst-strtod.c: Convert to test-driver. Split locale_test to... * stdlib/tst-strtod1i.c: ...this new file. * stdlib/tst-strtod5.c: Convert to test-driver and add copyright notice. Split tests of __strtod_internal to... * stdlib/tst-strtod5i.c: ...this new file. * string/test-string.h: Include stdint.h. Duplicate definition of inhibit_loop_to_libcall here (from libc-symbols.h). * string/test-strstr.c: Provide dummy definition of libc_hidden_builtin_def when including strstr.c. * sysdeps/ia64/fpu/libm-symbols.h: Suppress entire file in _ISOMAC mode; no need to test __STRICT_ANSI__ nor __cplusplus as well. * sysdeps/x86_64/fpu/math-tests-arch.h: Include cpu-features.h. Don't include init-arch.h. * sysdeps/x86_64/multiarch/test-multiarch.h: Include cpu-features.h. Don't include init-arch.h. * elf/Makefile: Move tst-ptrguard1-static, tst-stackguard1-static, tst-tls1-static, tst-tls2-static, tst-tls3-static, loadtest, unload, unload2, circleload1, neededtest, neededtest2, neededtest3, neededtest4, tst-tls1, tst-tls2, tst-tls3, tst-tls6, tst-tls7, tst-tls8, tst-dlmopen2, tst-ptrguard1, tst-stackguard1, tst-_dl_addr_inside_object, and all of the ifunc tests to tests-internal. Don't add $(modules-names) to test-extras. * inet/Makefile: Move tst-inet6_scopeid_pton to tests-internal. Add tst-deadline to tests-static-internal. * malloc/Makefile: Move tst-mallocstate and tst-scratch_buffer to tests-internal. * misc/Makefile: Move tst-atomic and tst-atomic-long to tests-internal. * nptl/Makefile: Move tst-typesizes, tst-rwlock19, tst-sem11, tst-sem12, tst-sem13, tst-barrier5, tst-signal7, tst-tls3, tst-tls3-malloc, tst-tls5, tst-stackguard1, tst-sem11-static, tst-sem12-static, and tst-stackguard1-static to tests-internal. Link tests-internal with libpthread also. Don't add $(modules-names) to test-extras. * nss/Makefile: Move tst-field to tests-internal. * posix/Makefile: Move bug-regex5, bug-regex20, bug-regex33, tst-rfc3484, tst-rfc3484-2, and tst-rfc3484-3 to tests-internal. * stdlib/Makefile: Move tst-strtod1i, tst-strtod3, tst-strtod4, tst-strtod5i, tst-tls-atexit, and tst-tls-atexit-nodelete to tests-internal. * sunrpc/Makefile: Move tst-svc_register to tests-internal. * sysdeps/powerpc/Makefile: Move test-get_hwcap and test-get_hwcap-static to tests-internal. * sysdeps/unix/sysv/linux/Makefile: Move tst-setgetname to tests-internal. * sysdeps/x86_64/fpu/Makefile: Add all libmvec test modules to modules-names-tests.
* Consolidate Linux writev implementationAdhemerval Zanella2017-05-111-0/+27
| | | | | | | | | | This patch consolidates the writev Linux syscall implementation on sysdeps/unix/sysv/linux/writev.c. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/writev.c: New file.
* Consolidate Linux readv implementationAdhemerval Zanella2017-05-111-0/+27
| | | | | | | | | | This patch consolidates the readv Linux syscall implementation on sysdeps/unix/sysv/linux/readv.c. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/readv.c: New file.
* Consolidate Linux write syscallAdhemerval Zanella2017-05-111-0/+33
| | | | | | | | | | | | | This patch consolidates the write Linux syscall implementation on sysdeps/unix/sysv/linux/write.c. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * include/unistd.h (write): Add hidden proto. * io/Makefile (CFLAGS-write.c): New rule. * nptl/Makefile (CFLAGS-write.c): Likewise. * sysdeps/unix/sysv/linux/write.c: New file.
* Consolidate Linux read syscallAdhemerval Zanella2017-05-111-0/+33
| | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the read Linux syscall implementation on sysdeps/unix/sysv/linux/read.c. This leads to a different frame pointer creation on some architectures: * It fixes BZ#21428 on aarch64, since now the returned address for the read syscall can be correctly found out by backtrace_symbols. * It makes tst-backtrace{5,6} fails on powerpc due an issue on its custom backtrace implementation. It is fixed on subsequent patch from this set. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. [BZ #21428] * include/unistd.h (read): Add hidden proto. * io/Makefile (CFLAGS-read.c): New rule. * nptl/Makefile (CFLAGS-read.c): New rule. * sysdeps/unix/sysv/linux/read.c: New file.
* Consolidate Linux creat implementationAdhemerval Zanella2017-05-116-18/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the creat Linux syscall implementation on sysdeps/unix/sysv/linux/creat{64}.c. The changes are: 1. Remove creat{64} from auto-generation syscalls.list. 2. Add a new creat{64}.c implementation. For architectures that define __OFF_T_MATCHES_OFF64_T the default creat64 will create alias to required creat symbols. 3. Use __NR_creat where possible, otherwise use internal open{64} call with expected flags. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * io/Makefile (CFLAGS-creat.c): New rule. (CFLAGS-creat64.c): Likewise. * sysdeps/unix/sysv/linux/alpha/creat.c: Remove file. * sysdeps/unix/sysv/linux/generic/creat.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/creat64.c: Likewise. * sysdeps/unix/sysv/linux/creat.c: New file. * sysdeps/unix/sysv/linux/creat64.c: Likewise. * sysdeps/unix/sysv/linux/syscalls.list: Remove create from auto-generated list. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise.
* Consolidate Linux open implementationAdhemerval Zanella2017-05-115-68/+27
| | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the open Linux syscall implementation on sysdeps/unix/sysv/linux/open{64}.c. The changes are: 1. Remove open{64} from auto-generation syscalls.list. 2. Add a new open{64}.c implementation. For architectures that define __OFF_T_MATCHES_OFF64_T the default open64 will create alias to required open symbols. 3. Use __NR_openat as default syscall for open{64}. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/generic/open.c: Remove file. * sysdeps/unix/sysv/linux/generic/open64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/open64.c: Likewise. * sysdeps/unix/sysv/linux/open.c: New file. * sysdeps/unix/sysv/linux/open64.c (__libc_open64): Use O_LARGEFILE only for __OFF_T_MATCHES_OFF64_T and add alias to open if the case. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Remove open from auto-generated list.
* Consolidate Linux close syscall generationAdhemerval Zanella2017-05-111-0/+30
| | | | | | | | | | | This patch consolidates the close Linux syscall generation on sysdeps/unix/sysv/linux/close.c. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * nptl/Makefile (CFLAGS-close.c): New flag. * sysdeps/unix/sysv/linux/close.c: New file.
* Condition some sys/ucontext.h contents on __USE_MISC (bug 21457).Joseph Myers2017-05-117-59/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing the fixes for namespace issues arising from sys/ucontext.h, this patch conditions various definitions, that are not needed for defining mcontext_t / ucontext_t, on __USE_MISC, so they do not appear in strict POSIX modes. This patch is non-exhaustive; that is, it only conditions straightforward cases and there may be more such definitions that can be conditioned for these and other architectures, to be dealt with later in separate patches. Also, using __USE_MISC is the minimum change for these definitions where they conflict with POSIX; some headers already have __USE_GNU conditionals on similar definitions of names for registers. The patch specifically does not do anything with definitions in bits/sigcontext.h, and nor does it condition any inclusions of bits/sigcontext.h even where in fact that is not needed on some architectures for the definitions of mcontext_t / ucontext_t. As other namespace issues in these headers remain, this patch does not fix bug 21457, nor allow any XFAILs to be removed. Tested with build-many-glibcs.py. [BZ #21457] * sysdeps/arm/sys/ucontext.h (R0): Condition on [__USE_MISC]. (R1): Likewise. (R2): Likewise. (R3): Likewise. (R4): Likewise. (R5): Likewise. (R6): Likewise. (R7): Likewise. (R8): Likewise. (R9): Likewise. (R10): Likewise. (R11): Likewise. (R12): Likewise. (R13): Likewise. (R14): Likewise. (R15): Likewise. * sysdeps/i386/sys/ucontext.h (REG_GS): Likewise. (REG_FS): Likewise. (REG_ES): Likewise. (REG_DS): Likewise. (REG_EDI): Likewise. (REG_ESI): Likewise. (REG_EBP): Likewise. (REG_ESP): Likewise. (REG_EBX): Likewise. (REG_EDX): Likewise. (REG_ECX): Likewise. (REG_EAX): Likewise. (REG_TRAPNO): Likewise. (REG_ERR): Likewise. (REG_EIP): Likewise. (REG_CS): Likewise. (REG_EFL): Likewise. (REG_UESP): Likewise. (REG_SS): Likewise. * sysdeps/m68k/sys/ucontext.h (R_D0): Likewise. (R_D1): Likewise. (R_D2): Likewise. (R_D3): Likewise. (R_D4): Likewise. (R_D5): Likewise. (R_D6): Likewise. (R_D7): Likewise. (R_A0): Likewise. (R_A1): Likewise. (R_A2): Likewise. (R_A3): Likewise. (R_A4): Likewise. (R_A5): Likewise. (R_A6): Likewise. (R_A7): Likewise. (R_SP): Likewise. (R_PC): Likewise. (R_PS): Likewise. (fpregset_t): Likewise. (MCONTEXT_VERSION): Likewise. * sysdeps/mips/sys/ucontext.h (CTX_R0): Likewise. (CTX_AT): Likewise. (CTX_V0): Likewise. (CTX_V1): Likewise. (CTX_A0): Likewise. (CTX_A1): Likewise. (CTX_A2): Likewise. (CTX_A3): Likewise. (CTX_T0): Likewise. (CTX_T1): Likewise. (CTX_T2): Likewise. (CTX_T3): Likewise. (CTX_T4): Likewise. (CTX_T5): Likewise. (CTX_T6): Likewise. (CTX_T7): Likewise. (CTX_S0): Likewise. (CTX_S1): Likewise. (CTX_S2): Likewise. (CTX_S3): Likewise. (CTX_S4): Likewise. (CTX_S5): Likewise. (CTX_S6): Likewise. (CTX_S7): Likewise. (CTX_T8): Likewise. (CTX_T9): Likewise. (CTX_K0): Likewise. (CTX_K1): Likewise. (CTX_GP): Likewise. (CTX_SP): Likewise. (CTX_S8): Likewise. (CTX_RA): Likewise. (CTX_MDLO): Likewise. (CTX_MDHI): Likewise. (CTX_CAUSE): Likewise. (CTX_EPC): Likewise. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Condition inclusion of <sys/procfs.h> on [__USE_MISC]. (greg_t): Condition on [__USE_MISC]. (gregset_t): Likewise. (fpregset_t): Likewise. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h (greg_t): Likewise. (NGREG): Likewise. (gregset_t): Likewise. (REG_R0): Likewise. (REG_R1): Likewise. (REG_R2): Likewise. (REG_R3): Likewise. (REG_R4): Likewise. (REG_R5): Likewise. (REG_R6): Likewise. (REG_R7): Likewise. (REG_R8): Likewise. (REG_R9): Likewise. (REG_R10): Likewise. (REG_R11): Likewise. (REG_R12): Likewise. (REG_R13): Likewise. (REG_R14): Likewise. (REG_R15): Likewise. (struct _libc_fpstate): Likewise. (fpregset_t): Likewise. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h (NGREG): Likewise. (NFPREG): Likewise. (gregset_t): Likewise. (fpregset_t): Likewise. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (R_D0): Likewise. (R_D1): Likewise. (R_D2): Likewise. (R_D3): Likewise. (R_D4): Likewise. (R_D5): Likewise. (R_D6): Likewise. (R_D7): Likewise. (R_A0): Likewise. (R_A1): Likewise. (R_A2): Likewise. (R_A3): Likewise. (R_A4): Likewise. (R_A5): Likewise. (R_A6): Likewise. (R_A7): Likewise. (R_SP): Likewise. (R_PC): Likewise. (R_PS): Likewise. (fpregset_t): Likewise. (MCONTEXT_VERSION): Likewise. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (MCONTEXT_VERSION): Likewise. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h (REG_R0): Likewise. (REG_R1): Likewise. (REG_R2): Likewise. (REG_R3): Likewise. (REG_R4): Likewise. (REG_R5): Likewise. (REG_R6): Likewise. (REG_R7): Likewise. (REG_R8): Likewise. (REG_R9): Likewise. (REG_R10): Likewise. (REG_R11): Likewise. (REG_R12): Likewise. (REG_R13): Likewise. (REG_R14): Likewise. (REG_R15): Likewise. * sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Condition inclusion of <arch/abi.h> on [__USE_MISC]. (greg_t): Condition on [__USE_MISC]. (NGREG): Likewise. (gregset_t): Likewise.
* Remove MIPS32 accept4, recvmmsg, sendmmsg implementations.Joseph Myers2017-05-093-88/+0
| | | | | | | | | | | | | | | | | | MIPS32 has its own implementations of accept4, recvmmsg and sendmmsg because at one point it needed to avoid socketcall being used for those functions (MIPS32 has socketcall, but has never used it in glibc, and so never had socket.S at the time when socketcall used such a per-architecture file instead of C code). The current code no longer uses socketcall based on __NR_socketcall being defined, and the syscalls are always present on MIPS for supported kernels so the socketcall case in the code is dead for MIPS; this patch removes the implementations that are, as Adhemerval noted, no longer needed. Tested compilation for mips-linux-gnu with build-many-glibcs.py. * sysdeps/unix/sysv/linux/mips/mips32/accept4.c: Remove file. * sysdeps/unix/sysv/linux/mips/mips32/recvmmsg.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/sendmmsg.c: Likewise.
* Simplify accept4, recvmmsg, sendmmsg code.Joseph Myers2017-05-099-65/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The accept4, recvmmsg and sendmmsg functions had macros __ASSUME_*_SYSCALL_WITH_SOCKETCALL. Before we could assume kernels with the relevant functionality, these macros represented the conditions under which, on a socketcall architecture, glibc could just call the syscall unconditionally and not have to deal with socketcall at all for those functions, because if the syscall didn't work for them the socketcall call wouldn't either. Now we can assume kernels with the relevant functionality, the only question is whether we can assume the syscall is present; if not, we are on a socketcall architecture and just use socketcall instead. Thus, this patch removes the macros that are no longer necessary, and simplifies the code for accept4, recvmmsg and sendmmsg to use the same logic as the other C implementations of socket functions that may use a syscall or socketcall depending on kernel support. Tested for x86_64 and x86. * sysdeps/unix/sysv/linux/accept4.c (accept4): Use syscall if [__ASSUME_ACCEPT4_SYSCALL], otherwise socketcall. * sysdeps/unix/sysv/linux/recvmmsg.c (recvmmsg): Use syscall if [__ASSUME_RECVMMSG_SYSCALL], otherwise socketcall. * sysdeps/unix/sysv/linux/sendmmsg.c (__sendmmsg): Use syscall if [__ASSUME_SENDMMSG_SYSCALL], otherwise socketcall. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_ACCEPT4_SYSCALL): Move to general list of macros for socket syscalls. (__ASSUME_RECVMMSG_SYSCALL): Likewise. (__ASSUME_SENDMMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL): Remove. (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL): Remove. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL): Likewise. (__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL): Likewise. (__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise.
* Simplify sendmmsg code.Joseph Myers2017-05-092-68/+12
| | | | | | | | | | | | | | | | | | | Now we can assume a kernel with sendmmsg support, this patch simplifies the implementation to be similar to that for accept4: either using socketcall or the syscall according to whether the syscall is known to be available, without further fallback implementations. The __ASSUME_SENDMMSG macro is kept (now defined unconditionally), since it's used in resolv/res_send.c. Tested for x86_64 and x86. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_SENDMMSG_SYSCALL): Define unconditionally. (__ASSUME_SENDMMSG): Likewise. (__ASSUME_SENDMMSG_SOCKETCALL): Remove macro. * sysdeps/unix/sysv/linux/sendmmsg.c (__sendmmsg): Define using sendmmsg syscall if that can be assumed to be present, socketcall otherwise, with no fallback for runtime failure.
* Simplify recvmmsg code.Joseph Myers2017-05-092-68/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now we can assume a kernel with recvmmsg support, this patch simplifies the implementation to be similar to that for accept4: either using socketcall or the syscall according to whether the syscall is known to be available, without further fallback implementations. (In fact further simplification is possible, getting rid of the __ASSUME_*_SYSCALL_WITH_SOCKETCALL macros now that the minimum kernel is guaranteed support for all of accept4, recvmmsg, sendmmsg, whether through syscalls or through socketcall. I intend to do that for all of accept4 / recvmmsg / sendmmsg together - so making their implementations just like those for older socket functions - once the basic cleanup for 3.2 minimum kernel is done for sendmmsg as well as recvmmsg.) Tested for x86_64 and x86. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_RECVMMSG_SYSCALL): Define unconditionally. (__ASSUME_RECVMMSG_SOCKETCALL): Remove macro. (__ASSUME_RECVMMSG): Likewise. * sysdeps/unix/sysv/linux/recvmmsg.c (recvmmsg): Define using recvmmsg syscall if it can be assumed to be present, socketcall otherwise, with no fallback for runtime failure.
* Assume prlimit64 is available.Joseph Myers2017-05-095-85/+3
| | | | | | | | | | | | | | | | | | | | | | | This patch makes sysdeps/unix/sysv/linux code assume the prlimit64 syscall is always available, given the minimum of a 3.2 kernel. __ASSUME_PRLIMIT64, which in fact was no longer used, is removed. Code conditional on __NR_prlimit64 being defined is made unconditional. Fallback code for the case where prlimit64 produces an ENOSYS error is removed, substantially simplifying some functions. Tested for x86_64 and x86. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_PRLIMIT64): Remove macro. * sysdeps/unix/sysv/linux/getrlimit64.c (__getrlimit64): Assume prlimit64 is always available and does not give an ENOSYS error. * sysdeps/unix/sysv/linux/prlimit.c [__NR_prlimit64]: Make code unconditional. [!__NR_prlimit64]: Remove conditional code. * sysdeps/unix/sysv/linux/setrlimit.c (__setrlimit): Assume prlimit64 is always available and does not give an ENOSYS error. * sysdeps/unix/sysv/linux/setrlimit64.c (__setrlimit64): Likewise.
* Remove __ASSUME_PROC_PID_TASK_COMM.Joseph Myers2017-05-082-19/+0
| | | | | | | | | | | | | | This patch removes the __ASSUME_PROC_PID_TASK_COMM macro, and associated conditional code (in a testcase), now that 3.2 is the global minimum Linux kernel version supported. Tested for x86_64. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_PROC_PID_TASK_COMM): Remove macro. * sysdeps/unix/sysv/linux/tst-setgetname.c: Do not include <kernel-features.h>. (do_test) [!__ASSUME_PROC_PID_TASK_COMM]: Remove conditional code.
* Remove __ASSUME_GETCPU_SYSCALL.Joseph Myers2017-05-081-5/+0
| | | | | | | | | | | | | | | | | | | This patch removes the definition of __ASSUME_GETCPU_SYSCALL. In fact this macro is unused, probably since: commit dd26c44403582fdf10d663170f947dfe4b3207a0 Author: Adhemerval Zanella <adhemerval.zanella@linaro.com> Date: Wed Apr 22 14:21:39 2015 -0300 Consolidate sched_getcpu so it could have been removed even without the move to 3.2 as minimum kernel version on x86_64. Tested for x86_64. * sysdeps/unix/sysv/linux/x86_64/kernel-features.h (__ASSUME_GETCPU_SYSCALL): Remove macro.
* Remove <sys/ultrasound.h>Florian Weimer2017-05-082-2/+1
| | | | | This header was once used for constants related to the Gravis Ultrasound sound card.
* Require Linux kernel 3.2 or later on x86 / x86_64.Joseph Myers2017-05-084-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As per the recent discussion, this patch implements a requirement for Linux 3.2 or later for x86 and x86_64. This is only the initial change to increase the configured minimum; it's expected that followup patches would deal with associated removal of conditionals that are no longer needed. If we remove the start-up test on the kernel version, of course the NEWS and README text should then be revised (to reflect that this version is just one such that glibc does not intend to include compatibility code for any older kernel version, rather than older kernels necessarily failing to work or glibc necessarily having compatibility code for newer interfaces). The followups would be able to assume presence of getcpu (x86_64), recvmmsg (not always through its own syscall, sometimes only through socketcall), sendmmsg (likewise), /proc/$pid/task/$tid/comm, f_flags from statfs, prlimit64. Tested for x86_64 and x86. * sysdeps/unix/sysv/linux/i386/configure.ac (arch_minimum_kernel): Remove. * sysdeps/unix/sysv/linux/i386/configure: Regenerated. * sysdeps/unix/sysv/linux/x86_64/64/configure.ac (arch_minimum_kernel): Remove. * sysdeps/unix/sysv/linux/x86_64/64/configure: Regenerated. * README: Update statement about Linux kernel requirements.
* Use __glibc_reserved convention in mcontext, sigcontext (bug 21457).Joseph Myers2017-05-043-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the most straightforward part of fixing namespace issues for sys/ucontext.h and related headers: where fields in sys/ucontext.h or bits/sigcontext.h are named "reserved", "padding" or similar, they are renamed to use the __glibc_reserved* naming convention. It does not change fields with a leading underscore, or even those with a prefix such as uc_ or sc_. It only fixes a small part of bug 21457, so no XFAILs are removed. Tested for x86_64 and x86, and with build-many-glibcs.py. [BZ #21457] * sysdeps/unix/sysv/linux/mips/sys/ucontext.h [_MIPS_SIM != _ABIO32] (mcontext_t): Rename field reserved to __glibc_reserved1. * sysdeps/unix/sysv/linux/x86/bits/sigcontext.h (struct _fpx_sw_bytes): Rename field padding to __glibc_reserved1. (struct _fpxreg): Likewise. [!__x86_64__] (struct _fpstate): Rename field reserved to __glibc_reserved1. Rename field padding to __glibc_reserved2. [__x86_64__] (struct _fpstate): Rename field padding to __glibc_reserved1. (struct _xsave_hdr): Rename field reserved1 to __glibc_reserved1. Rename field reserved2 to __glibc_reserved2. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h [__x86_64__] (struct _libc_fpxreg): Rename field padding to __glibc_reserved1. [__x86_64__] (struct _libc_fpstate): Rename field padding to __glibc_reserved1.
* x86: Set dl_platform and dl_hwcap from CPU features [BZ #21391]H.J. Lu2017-05-032-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dl_platform and dl_hwcap are set from AT_PLATFORM and AT_HWCAP very early during startup. They are used by dynamic linker to determine platform and build an array of hardware capability names, which are added to search path when loading shared object. dl_platform and dl_hwcap are unused on x86-64. On i386, i386, i486, i586 and i686 platforms were supported and only SSE2 capability was used. On x86, usage of AT_PLATFORM and AT_HWCAP to determine platform and processor capabilities is obsolete since all information is available in dl_x86_cpu_features. This patch sets dl_platform and dl_hwcap from dl_x86_cpu_features in dynamic linker. On i386, the available plaforms are changed to i586 and i686 since i386 has been deprecated. On x86-64, the available plaforms are haswell, which is for Haswell class processors with BMI1, BMI2, LZCNT, MOVBE, POPCNT, AVX2 and FMA, and xeon_phi, which is for Xeon Phi class processors with AVX512F, AVX512CD, AVX512ER and AVX512PF. A capability, avx512_1, is also added to x86-64 for AVX512 ISAs: AVX512F, AVX512CD, AVX512BW, AVX512DQ and AVX512VL. [BZ #21391] * sysdeps/i386/dl-machine.h (dl_platform_init) [IS_IN (rtld)]: Only call init_cpu_features. [!IS_IN (rtld)]: Only set GLRO(dl_platform) to NULL if needed. * sysdeps/x86_64/dl-machine.h (dl_platform_init): Likewise. * sysdeps/i386/dl-procinfo.h: Removed. * sysdeps/unix/sysv/linux/i386/dl-procinfo.h: Don't include <sysdeps/i386/dl-procinfo.h> nor <ldsodefs.h>. Include <sysdeps/x86/dl-procinfo.h>. (_dl_procinfo): Replace _DL_HWCAP_COUNT with 32. * sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h [!IS_IN (ldconfig)]: Include <sysdeps/x86/dl-procinfo.h> instead of <sysdeps/generic/dl-procinfo.h>. * sysdeps/x86/cpu-features.c: Include <dl-hwcap.h>. (init_cpu_features): Set dl_platform, dl_hwcap and dl_hwcap_mask. * sysdeps/x86/cpu-features.h (bit_cpu_LZCNT): New. (bit_cpu_MOVBE): Likewise. (bit_cpu_BMI1): Likewise. (bit_cpu_BMI2): Likewise. (index_cpu_BMI1): Likewise. (index_cpu_BMI2): Likewise. (index_cpu_LZCNT): Likewise. (index_cpu_MOVBE): Likewise. (index_cpu_POPCNT): Likewise. (reg_BMI1): Likewise. (reg_BMI2): Likewise. (reg_LZCNT): Likewise. (reg_MOVBE): Likewise. (reg_POPCNT): Likewise. * sysdeps/x86/dl-hwcap.h: New file. * sysdeps/x86/dl-procinfo.h: Likewise. * sysdeps/x86/dl-procinfo.c (_dl_x86_hwcap_flags): New. (_dl_x86_platforms): Likewise.
* Consolidate Linux epoll_wait syscallAdhemerval Zanella2017-05-034-5/+8
| | | | | | | | | | | | | | This patch consolidates the epoll_wait Linux syscall generation on sysdeps/unix/sysv/linux/epoll_wait.c. The implementation tries to use __NR_epoll_wait if defined, otherwise calls epoll_pwait. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/epoll_wait.c: New file. * sysdeps/unix/sysv/linux/generic/epoll_wait.c: Remove file. * sysdeps/unix/sysv/linux/syscalls.list: Remove epoll_wait from auto-generation list.
* Consolidate Linux select implementationAdhemerval Zanella2017-05-036-11/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the select Linux syscall implementation on sysdeps/unix/sysv/linux/select.c. The changes are: 1. Remove select from auto-generation syscalls.list on the architecture that uses __NR_select. 2. Remove generic implementation add a default one that handle all current cases (with the expection of alpha) The new default implementation will either use __NR_select if available of fallback to __NR_pselect6 otherwise. 3. Add a alpha outlier implementation which requires old compatibility symbols. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/alpha/Makefile (sysdep_routines): Add osf_select. * sysdeps/unix/sysv/linux/alpha/select.c: New file. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove select and osf_select from auto-generation list. * sysdeps/unix/sysv/linux/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/select.c: Remove file. * sysdeps/unix/sysv/linux/select.c: New file.
* Consolidate Linux poll implementationAdhemerval Zanella2017-05-032-3/+6
| | | | | | | | | | | | | | | | This patch consolidates the poll Linux syscall implementation on sysdeps/unix/sysv/linux/poll.c. It basically removes poll from auto-generation list and add a default implementation that either call __NR_poll directly (if the kernel headers defines it) or ppoll adjusting the timeout argument (as the generic implementation). Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/generic/poll.c: Remove file. * sysdeps/unix/sysv/linux/poll.c: New file. * sysdeps/unix/sysv/linux/syscalls.list: Remove poll from auto-generation list.
* Add HWCAP_ASIMDRDM from Linux 4.11 to AArch64 bits/hwcap.h.Joseph Myers2017-05-031-0/+1
| | | | | | | | | | This patch adds the HWCAP_ASIMDRDM macro from Linux 4.11 to the AArch64 bits/hwcap.h. Tested (compilation only) with build-many-glibcs.py. * sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_ASIMDRDM): New macro.
* posix: Fix internal p{read,write} plt usageAdhemerval Zanella2017-05-024-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds internal alias for __pread, __pread64, and __pwrite following the already in place one for __pwrite64. This is not used in any implementation but on microblaze on preadv/pwritev fallback (since it does not define __ASSUME_PREADV). In fact it was signaled by commit c35db50ff5 which update the expected localptl.data for the architecture based on resulted value. This patch updates the plt for microblaze now that p{read,write}{64} are correctly routed to use internal alias. Checked on x86_64-linux-gnu and a build for all supported architectures (no all variants although). * include/unistd.h (__pread): Add libc_hidden_proto. (__pread64): Likewise. (__pwrite): Likewise. * sysdeps/unix/sysv/linux/microblaze/localplt.data [libc.so] (__pread64): Remove. * sysdeps/unix/sysv/linux/pread.c (__pread64): Add libc_hidden_weak. * sysdeps/unix/sysv/linux/pread64.c (__pread64): Likewise. * sysdeps/unix/sysv/linux/pwrite.c (__pwrite): Likewise.
* Add PF_SMC, AF_SMC from Linux 4.11 to bits/socket.h.Joseph Myers2017-05-011-1/+3
| | | | | | | | | | | This patch adds the PF_SMC / AF_SMC macros from Linux 4.11 to sysdeps/unix/sysv/linux/bits/socket.h. Tested for x86_64. * sysdeps/unix/sysv/linux/bits/socket.h (PF_SMC): New macro. (PF_MAX): Set to 44. (AF_SMC): New macro.
* powerpc64le: Create divergent sysdep directory for powerpc64le.Paul E. Murphy2017-04-282-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | float128 on powerpc64le requires the addition of the ieee754/float128 sysdep, whereas powerpc64 doesn't. This requires creating a bunch of submachine and cpu directories and Implies files which just point towards their powerpc64 equivalent. Tested on P7, P8, and generic powerpc64le targets with and without multiarch. * sysdeps/powerpc/powerpc64le/Implies: New file. * sysdeps/powerpc/powerpc64le/fpu/Implies: New file. * sysdeps/powerpc/powerpc64le/fpu/multiarch/Implies: New file. * sysdeps/powerpc/powerpc64le/multiarch/Implies: New file. * sysdeps/powerpc/powerpc64le/power7/Implies: New file. * sysdeps/powerpc/powerpc64le/power7/fpu/Implies: New file. * sysdeps/powerpc/powerpc64le/power7/fpu/multiarch/Implies: New file. * sysdeps/powerpc/powerpc64le/power7/multiarch/Implies: New file. * sysdeps/powerpc/powerpc64le/power8/Implies: New file. * sysdeps/powerpc/powerpc64le/power8/fpu/Implies: New file. * sysdeps/powerpc/powerpc64le/power8/fpu/multiarch/Implies: New file. * sysdeps/powerpc/powerpc64le/power8/multiarch/Implies: New file. * sysdeps/powerpc/powerpc64le/power9/Implies: New file. * sysdeps/powerpc/powerpc64le/power9/fpu/Implies: New file. * sysdeps/powerpc/powerpc64le/power9/fpu/multiarch/Implies: New file. * sysdeps/powerpc/powerpc64le/power9/multiarch/Implies: New file. * sysdeps/powerpc/preconfigure: New file. * sysdeps/unix/sysv/linux/powerpc/powerpc64le/Implies: New file. * sysdeps/unix/sysv/linux/powerpc/powerpc64le/fpu/Implies: New file.
* Fix sys/socket.h namespace issues from sys/uio.h inclusion (bug 21426).Joseph Myers2017-04-251-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sys/socket.h includes sys/uio.h to get the definition of the iovec structure. POSIX allows sys/socket.h to make all sys/uio.h symbols visible. However, all of sys/uio.h is XSI-shaded, so for non-XSI POSIX this results in conformtest failures (for sys/socket.h and other headers that include it): Namespace violation: "UIO_MAXIOV" Namespace violation: "readv" Namespace violation: "writev" Now, there is some ambiguity in POSIX about what namespace reservations apply in this case - see http://austingroupbugs.net/view.php?id=1127 - but glibc convention would still avoid declaring readv and writev, for example, for feature test macros that don't include them (if only headers from the relevant standard are included), even if such declarations are permitted, so there is a bug here according to glibc conventions. This patch moves the struct iovec definition to a new bits/types/struct_iovec.h header and includes that from sys/socket.h instead of including the whole of sys/uio.h. This fixes the namespace issue; however, three files in glibc that were relying on the implicit inclusion needed to be updated to include sys/uio.h explicitly. So there is a question of whether sys/socket.h should continue to include sys/uio.h under some conditions, such as __USE_XOPEN or __USE_MISC or __USE_XOPEN || __USE_MISC, for greater compatibility with code that (wrongly) expects this optional inclusion to be present there. (I think the three affected files in glibc should still have explicit sys/uio.h inclusions added in any case, however.) Tested for x86_64. [BZ #21426] * misc/bits/types/struct_iovec.h: New file. * misc/Makefile (headers): Add bits/types/struct_iovec.h. * include/bits/types/struct_iovec.h: New file. * bits/uio.h (struct iovec): Replace by inclusion of <bits/types/struct_iovec.h>. * sysdeps/unix/sysv/linux/bits/uio.h (struct iovec): Likewise. * socket/sys/socket.h: Include <bits/types/struct_iovec.h> instead of <sys/uio.h>. * nptl/tst-cancel4.c: Include <sys/uio.h> * posix/test-errno.c: Likewise. * support/resolv_test.c: Likewise. * conform/Makefile (test-xfail-POSIX2008/arpa/inet.h/conform): Remove. (test-xfail-POSIX2008/netdb.h/conform): Likewise. (test-xfail-POSIX2008/netinet/in.h/conform): Likewise. (test-xfail-POSIX2008/sys/socket.h/conform): Likewise.
* posix: Remove ununsed posix_spawn internal assignmentAdhemerval Zanella2017-04-251-16/+14
| | | | | | | | | | The internal 'ret' variable in '__spawni_child' function is not used after assignment in most cases. Checked on x86_64-linux-gnu. * sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Remove ununsed assignment.
* [BZ 21340] add support for POSIX_SPAWN_SETSIDAdhemerval Zanella2017-04-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the POSIX_SPAWN_SETSID flag. It was recently accepted by the Austin Group: http://austingroupbugs.net/view.php?id=1044 Checked on x86_64 Daurnimator <quae@daurnimator.com> Adhemerval Zanella <adhemerval.zanella@linaro.org> [BZ #21340] * posix/Makefile (tests): Add tst-posix_spawn-setsid to list of tests. * posix/spawn.h: define POSIX_SPAWN_SETSID flag. * posix/spawnattr_setflags.c (ALL_FLAGS): Add POSIX_SPAWN_SETSID to valid flags. * posix/tst-posix_spawn-setsid.c: Add test for POSIX_SPAWN_SETSID. * sysdeps/mach/hurd/spawni.c (__spawni): Implementation of POSIX_SPAWN_SETSID. * sysdeps/posix/spawni.c (__spawni): Likewise. * sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Likewise. * NEWS: Add note about POSIX_SPAWN_SETSID support.
* Create more sockets with SOCK_CLOEXEC [BZ #15722]Florian Weimer2017-04-192-2/+2
|
* Assume that accept4 is always available and worksFlorian Weimer2017-04-195-77/+18
| | | | | | | | | | Simplify the Linux accept4 implementation based on the assumption that it is available in some way. __ASSUME_ACCEPT4_SOCKETCALL was previously unused, so remove it. For ia64, the accept4 system call (and socket call) were backported in kernel version 3.2.18. Reflect this in the installation instructions.
* Fix bits/socket.h IOC* namespace issues (bug 21267).Joseph Myers2017-04-181-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | sysdeps/unix/sysv/linux/bits/socket.h includes asm/socket.h. That includes asm/sockios.h, which on MIPS includes asm/ioctl.h, resulting in namespace violations from IOC* macros. bits/socket.h already has code to handle asm/socket.h unconditionally defining macros that are only wanted for __USE_MISC. This patch extends it to handle the IOC* macros as well (always undefining them if not defined when bits/socket.h was included, as I don't think they are part of the intended API even for __USE_MISC). It's possible there should also be a kernel fix - it's not clear to me that IOC* belong in the uapi headers, and even if they do they might best be split out into another header to avoid getting defined by this particular path. But since glibc needs to deal with existing kernel headers, it also seems appropriate to extend the existing workaround to these macros. Tested (compilation only) with build-many-glibcs.py. [BZ #21267] * sysdeps/unix/sysv/linux/bits/socket.h (IOCSIZE_MASK): Undefine if defined by <asm/socket.h> and not previously defined. (IOCSIZE_SHIFT): Likewise. (IOC_IN): Likewise. (IOC_INOUT): Likewise. (IOC_OUT): Likewise.
* Assume that O_CLOEXEC is always defined and worksFlorian Weimer2017-04-181-4/+0
|
* Assume that dup3 is availableFlorian Weimer2017-04-181-1/+0
|
* Assume that pipe2 is always availableFlorian Weimer2017-04-181-1/+0
| | | | | The Debian patches for Hurd (which are already required to build glibc before this commit) contain an implementation of pipe2.
* Consolidate Linux mmap implementation (BZ#21270)Adhemerval Zanella2017-04-1223-565/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates all Linux mmap implementations on default sysdeps/unix/sysv/linux/mmap{64}.c one. To accomodate all required architecture specific requeriments a new internal header is created (mmap_internal.h) where each architecture add its specific code requirements. Currently only x86_64 (to define MMAP_PREPARE to add MAP_32BITS), s390 (which have a different kernel ABI for mmap), m68k (which have variable minimum page sizes), and MIPS n32 (which zero extend the offset to handle negative one correctly) redefine the new header. The patch also fixes BZ#21270 where default mmap64 on architectures which uses mmap2 silent truncates large offsets value (larger than 1 << (page shift + 8 * sizeof (off_t)) or 1<<44 on architectures with 4096 bytes page size). The new consolidate implementation returns EINVAL as allowed by POSIX. It also adds a tests for on current tst-mmap-offset one. I have run a full make check on x86_64, x86_64-32, i686, aarch64, armhf, powerpc, powerpc64le, sparc64, and sparcv9 without any regressions. I also ran some basic tests (tst-mmap-offset) on sh4, m68k, and on qemu simulated MIPS32 and MIPS64. [BZ #21270] * posix/tst-mmap-offset.c (do_prepare): New function. (do_test): Rename to do_test_bz18877 and use FAIL_RET. (do_test_bz21270): New function. * sysdeps/unix/sysv/linux/aarch64/mmap.c: Remove file. * sysdeps/unix/sysv/linux/arm/mmap.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c: Likewise. * sysdeps/unix/sysv/linux/hppa/mmap.c: Likewise. * sysdeps/unix/sysv/linux/i386/mmap.c: Likewise. * sysdeps/unix/sysv/linux/m68k/mmap.S: Likewise. * sysdeps/unix/sysv/linux/m68k/mmap64.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/mmap.S: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/mmap.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/mmap.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/mmap64.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/mmap.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/mmap.S: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/mmap.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/mmap64.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/mmap.c: Likewise. * sysdeps/unix/sysv/linux/mmap_internal.h: New file. * sysdeps/unix/sysv/linux/m68k/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/s390/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list: Remove mmap from auto-generation list. * sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mmap.c: New file. * sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Add check for invalid offsets and support for mmap2 syscall.
* Consolidate pthreadtype.h placementConsolidate pthreadtype.h placementAdhemerval Zanella2017-04-103-437/+1
| | | | | | | | | | | | | | | | | | | | | This patch moves all arch specific pthreadtypes.h to a similar path for all architectures (sysdeps/unix/sysv/<arch>/bits). No functional or build change is expected. The idea is mainly to organize the header placement for all architectures. Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, tile{pro,gx}-linux-gnu, and x86_64-linux-gnu). * sysdeps/unix/sysv/linux/x86/Implies: New file. * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Move to ... * sysdeps/alpha/nptl/bits/pthreadtypes.h: ... here. * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Move to ... * sysdeps/powerpc/nptl/bits/pthreadtypes.h: ... here. * sysdeps/x86/bits/pthreadtypes.h: Move to ... * sysdeps/x86/nptl/bits/pthreadtypes.h: ... here.
* Build divdi3 only for architecture that required itAdhemerval Zanella2017-04-064-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in [1], divdi3 object is only exported in a handful ABIs (i386, m68k, powerpc32, s390-32, and ia64), however it is built for all current architectures regardless. This patch refact the make rules for this object to so only the aforementioned architectures that actually require it builds it. Also, to avoid internal PLT calls to the exported symbol from the module, glibc uses an internal header (symbol-hacks.h) which is unrequired (and in fact breaks the build for architectures that intend to get symbol definitions from libgcc.a). The patch also changes it to create its own header (divdi3-symbol-hacks.h) and adjust the architectures that require it accordingly. I checked the build/check (with run-built-tests=no) on the following architectures (which I think must cover all supported ABI/builds) using GCC 6.3: aarch64-linux-gnu alpha-linux-gnu arm-linux-gnueabihf hppa-linux-gnu ia64-linux-gnu m68k-linux-gnu microblaze-linux-gnu mips64-n32-linux-gnu mips-linux-gnu mips64-linux-gnu nios2-linux-gnu powerpc-linux-gnu powerpc-linux-gnu-power4 powerpc64-linux-gnu powerpc64le-linux-gnu s390x-linux-gnu s390-linux-gnu sh4-linux-gnu sh4-linux-gnu-soft sparc64-linux-gnu sparcv9-linux-gnu tilegx-linux-gnu tilegx-linux-gnu-32 tilepro-linux-gnu x86_64-linux-gnu x86_64-linux-gnu-x32 i686-linux-gnu I only saw one regression on sparcv9-linux-gnu (extra PLT call to .udiv) which I address in next patch in the set. It also correctly build SH with GCC 7.0.1 (without any regression from c89721e25d). [1] https://sourceware.org/ml/libc-alpha/2017-03/msg00243.html * sysdeps/i386/symbol-hacks.h: New file. * sysdeps/m68k/symbol-hacks.h: New file. * sysdeps/powerpc/powerpc32/symbol-hacks.h: New file. * sysdeps/s390/s390-32/symbol-hacks.h: New file. * sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = csu] (sysdep_routines): New rule: divdi3 object. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/m68k/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/wordsize-32/Makefile: Remove file. * sysdeps/wordsize-32/symbol-hacks.h: Definitions move to ... * sysdeps/wordsize-32/divdi3-symbol-hacks.h: ... here.
* Remove __ASSUME_REQUEUE_PIAdhemerval Zanella2017-04-045-9/+0
| | | | | | | | | | | | | | | | | | | | | | The new cond var implementation (ed19993b5b0d) removed all the __ASSUME_{REQUEUE_PI,FUTEX_LOCK_PI} internal usage so there is no need to keep defining it. This patch removes all USE_REQUEUE_PI and __ASSUME_REQUEUE_PI. It is as follow up from BZ#18463. Checked with a build for x86_64-linux-gnu, arm-linux-gnueabhf, m68-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu. * nptl/pthreadP.h (USE_REQUEUE_PI): Remove ununsed macro. * sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_REQUEUE_PI): Likewise. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_REQUEUE_PI): Likewise. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_REQUEUE_PI): Likewise. * sysdeps/unix/sysv/linux/mips/kernel-features.h (__ASSUME_REQUEUE_PI): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_REQUEUE_PI): Likewise.
* posix_spawn: use a larger min stack for -fstack-check [BZ #21253]Mike Frysinger2017-04-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | When glibc is built with -fstack-check, trying to use posix_spawn can lead to segfaults due to gcc internally probing stack memory too far. The new spawn API will allocate a minimum of 1 page, but the stack checking logic might probe a couple of pages. When it tries to walk them, everything falls apart. The gcc internal docs [1] state the default interval checking is one page. Which means we need two pages (the current one, and the next probed). No target currently defines it larger. Further, it mentions that the default minimum stack size needed to recover from an overflow is 4/8KiB for sjlj or 8/12KiB for others. But some Linux targets (like mips and ppc) go up to 16KiB (and some non-Linux targets go up to 24KiB). Let's create each child with a minimum of 32KiB slack space to support them all, and give us future breathing room. No test is added as existing ones crash. Even a simple call is enough to trigger the problem: char *argv[] = { "/bin/ls", NULL }; posix_spawn(NULL, "/bin/ls", NULL, NULL, argv, NULL); [1] https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gccint/Stack-Checking.html
* Fix more test-errno issuesAdhemerval Zanella2017-03-301-2/+7
| | | | | | | | | | | | | | | | | | This patch fixes some test-errno-linux unexpected returns for the tested syscalls on some older kernels (I saw it on a Linux 3.8 on armv7l). Basically: - inotify_add_watch: Linux v3.8 (676a0675c) removed the test to check at least one valid bit in flags (to return EINVAL). It was later added back in v3.9 (04df32fa1). - quotactl: returns ENOSYS for kernels not configured with CONFIG_QUOTA. Checked on x86_64-linux-gnu and armv7l-linux-gnueabihf. * sysdeps/unix/sysv/linux/test-errno-linux.c (do_test): Handle non expected inotify_add_watch and quotactl return.
* Consolidate set* Linux implementationAdhemerval Zanella2017-03-2864-379/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the Linux setegid, seteuid, setgid, setgroups, setregid, setresgid, setresuid, setreuid, and setuid implementation on default sysdeps/unix/sysv/linux/set*.c implementation. It basically removes all the architecture define implementations and add support for __NR_set*32 syscall on Linux default implementation. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/arm/setegid.c: Remove file. * sysdeps/unix/sysv/linux/arm/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setgid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/arm/setregid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setegid.c: Likewise. * sysdeps/unix/sysv/linux/i386/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/i386/setregid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setegid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setgid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setregid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setuid.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setegid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setgid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setregid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setegid.c: Likewise. * sysdeps/unix/sysv/linux/sh/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setgid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/sh/setregid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setregid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setuid.c: Likewise. * sysdeps/unix/sysv/linux/setegid.c (setegid): Use INLINE_SYSCALL_ERROR_RETURN_VALUE. * sysdeps/unix/sysv/linux/seteuid.c (seteuid): Likewise. * sysdeps/unix/sysv/linux/setgid.c (setgid): Use __NR_setgid32 if defined. * sysdeps/unix/sysv/linux/setgroups.c (setgroups): Use __NR_setgroups32 if defined. * sysdeps/unix/sysv/linux/setregid.c (__setregid): Use __NR_setregid32 if defined. * sysdeps/unix/sysv/linux/setresgid.c (__setresgid): Use __NR_setresgid32 is defined. * sysdeps/unix/sysv/linux/setresuid.c (__setresuid): Use __NR_setresuid32 if defined. * sysdeps/unix/sysv/linux/setreuid.c (__setreuid): Use __NR_setreuid32 if defined. * sysdeps/unix/sysv/linux/setuid.c (__setuid): Use __NR_setuid32 if defined.
* Define more termios.h macros unconditionally for alpha (bug 21277).Joseph Myers2017-03-271-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | termios.h should define IUCLC for UNIX98 and older XSI standards. The sysdeps/unix/sysv/linux/alpha version defines it only if __USE_MISC, so causing some conform/ tests to fail. Other versions define it unconditionally (I* being a reserved namespace for this header); the API should be consistent between architectures in the absence of a clear reason for it to differ (and given that a symbol is part of the API on two architectures, I don't see any reason for the feature test macros required ever to differ between those architectures), so this patch makes the alpha version define it unconditionally as well. Two non-POSIX macros alongside it, IMAXBEL and IUTF8, are also defined unconditionally on other architectures, so this patch makes them consistent by defining them unconditionally on alpha as well. Tested (compilation only) with build-many-glibcs.py. [BZ #21277] * sysdeps/unix/sysv/linux/alpha/bits/termios.h (IUCLC): Define unconditionally. (IMAXBEL): Likewise. (IUTF8): Likewise.
* conformtest: Add x32 XFAILs for mq_attr element types (bug 21279).Joseph Myers2017-03-201-1/+1
| | | | | | | | | | | | | | | | | | POSIX specifies long as the type of elements of struct mq_attr. For x32, they are __syscall_slong_t (i.e. long long). This patch XFAILs the corresponding tests for x32 in the conformtest expectations (the bug should not be closed without an actual fix). Tested with build-many-glibcs.py. [BZ #21279] * sysdeps/unix/sysv/linux/x86_64/x32/Makefile [$(subdir) = conform] (conformtest-xfail-conds): Update comment. * conform/data/mqueue.h-data (mq_attr.mq_flags): XFAIL for x86_64-x32-linux. (mq_attr.mq_maxmsg): Likewise. (mq_attr.mq_msgsize): Likewise. (mq_attr.mq_curmsgs): Likewise.
* conformtest: Add mips XFAIL for struct stat st_rdev type (bug 21278).Joseph Myers2017-03-201-1/+1
| | | | | | | | | | | | | | MIPS o32 struct stat has the wrong type of st_rdev. This patch XFAILs that test in the conformtest expectations for this case (the bug should not be closed without an actual fix, however). Tested with build-many-glibcs.py. [BZ #21278] * sysdeps/unix/sysv/linux/mips/mips32/Makefile [$(subdir) = conform] (conformtest-xfail-conds): Update comment. * conform/data/sys/stat.h-data (stat.st_rdev): XFAIL for mips-o32-linux.
* Fix alpha termios.h NL2, NL3 namespace (bug 21268).Joseph Myers2017-03-201-2/+4
| | | | | | | | | | | | | | | sysdeps/unix/sysv/linux/alpha/bits/termios.h defines NL2 and NL3 for __USE_MISC || __USE_XOPEN. These should only be defined for __USE_MISC as they are not part of any standard namespace. This patch conditions them accordingly, matching the powerpc version of the header (the only other one in glibc that defines these macros). Tested (compilation only) with build-many-glibcs.py. [BZ #21268] * sysdeps/unix/sysv/linux/alpha/bits/termios.h (NL2): Define only if [__USE_MISC] (NL3): Likewise.
* posix_spawn: fix stack setup on ia64 [BZ #21275]Mike Frysinger2017-03-201-5/+6
| | | | | | | | | The ia64-specific clone2 call expects the base of the stack mapping and the stack size as sep arguments, not an initial stack value as on other stack-grows-down architectures. Reuse the stack-grows-up macro so we pass in the right stack base. Reported-by: Matt Turner <mattst88@gentoo.org>
* linux ttyname and ttyname_r: do not return wrong resultsChristian Brauner2017-03-193-8/+59
| | | | | | | | | | | | | If a link (say /proc/self/fd/0) pointing to a device, say /dev/pts/2, in a parent mount namespace is passed to ttyname, and a /dev/pts/2 exists (in a different devpts) in the current namespace, then it returns /dev/pts/2. But /dev/pts/2 is NOT the current tty, it is a different file and device. Detect this case and return ENODEV. Userspace can choose to take this as a hint that the fd points to a tty device but to act on the fd rather than the link. Signed-off-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
* conformtest: XFAIL tv_nsec tests for x32 (bug 16437).Joseph Myers2017-03-181-0/+5
| | | | | | | | | | | | | | | | | This patch XFAILs the conformtest tv_nsec tests for x32 so that the incorrect type does not potentially hide other failures. As this is not a fix for the bug, it should remain open in Bugzilla. Tested (compilation only) with build-many-glibcs.py. [BZ #16437] * sysdeps/unix/sysv/linux/x86_64/x32/Makefile [$(subdir) = conform] (conformtest-xfail-conds): New variable. * conform/data/signal.h-data (timespec.tv_nsec): XFAIL for x86_64-x32-linux. * conform/data/sys/select.h-data (timespec.tv_nsec): Likewise. * conform/data/sys/stat.h-data (timespec.tv_nsec): Likewise. * conform/data/time.h-data (timespec.tv_nsec): Likewise.