about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/Makefile
Commit message (Collapse)AuthorAgeFilesLines
...
* io: Move file timestamps tests out of LinuxAdhemerval Zanella2021-04-151-1/+1
| | | | | | | | | | | | Now that libsupport abstract Linux possible missing support (either due FS limitation that can't handle 64 bit timestamp or architectures that do not handle values larger than unsigned 32 bit values) the tests can be turned generic. Checked on x86_64-linux-gnu and i686-linux-gnu. I also built the tests for i686-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* tst: Add test for sigtimedwaitLukasz Majewski2021-03-231-1/+1
| | | | | | | | | | | | | This change adds new test to assess sigtimedwait's timeout related functionality - the sigset_t is configured for SIGUSR1, which will not be triggered, so sigtimedwait just waits for timeout. To be more specific - two use cases are checked: - if sigtimedwait times out immediately when passed struct timespec has zero values of tv_nsec and tv_sec. - if sigtimedwait times out after timeout specified in passed argument Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Add test for ntp_gettimexLukasz Majewski2021-03-231-1/+2
| | | | | | This test is a wrapper on tst-ntp_gettime test. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Add test for ntp_gettimeLukasz Majewski2021-03-231-1/+1
| | | | | | | This code provides test to check if time on target machine is properly read via ntp_gettime syscall. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: misc/tst-ofdlocks-compat can be a regular testFlorian Weimer2021-03-091-1/+7
| | | | | | | | Now that compat_symbol_reference works in non-internal tests. Also do not build and run the test at all on architectures which do not have the pre-2.28 symbol version of fcntl. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: dirent/tst-readdir64-compat can be a regular testFlorian Weimer2021-03-091-1/+5
| | | | | | | | | | compat_symbol_reference works in non-internal tests now. Also avoid building the test for unsupported configurations at all. I verified by building with build-many-glibcs.py that GLIBC_2.1.3 works as the predecessor of GLIBC_2.2. (Symbol versions in the early days are complex.) Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Add test for ntp_adjtimeLukasz Majewski2021-03-081-1/+1
| | | | | | This test is a wrapper on tst-clock_adjtime test. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Add test for adjtimexLukasz Majewski2021-03-081-1/+1
| | | | | | This test is a wrapper on tst-clock_adjtime test. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Add test for clock_adjtimeLukasz Majewski2021-03-081-1/+2
| | | | | | | | | | | This code privides test to check if time on target machine is properly adjusted. The time is altered only when cross-test-ssh.sh is executed with --allow-time-setting flag. As the delta added to CLOCK_REALTIME is only 1 sec the original time is not restored and further tests are executed with this bias. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Add test for utimesLukasz Majewski2021-03-021-1/+1
| | | | | | | | | | | This patch provides test for utimes. It uses wrapper to read access and modification times to compare them with ones written by utimes. Moreover, access and modification times beyond the Y2038 threshold date (i.e. 32 bit time_t overflow) are also checked. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Add test for utimeLukasz Majewski2021-03-021-1/+1
| | | | | | | | | | This patch provides test for utime. It uses wrapper to read access and modification times to compare them with ones written by utime. Moreover, access and modification times beyond the Y2038 threshold date (i.e. 32 bit time_t overflow) are also checked. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* tst: Add test for futimensLukasz Majewski2021-03-021-1/+1
| | | | | | | | | | | This patch provides test for futimens. It uses wrapper, which reads access and modification time to compare them with ones written by futimens. Moreover, access and modification times beyond the Y2038 threshold date (i.e. 32 bit time_t overflow) are also checked. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* linux: Consolidate internal_statvfsAdhemerval Zanella2021-02-111-1/+1
| | | | | | | | | | | Remove the internal_statvfs64.c and open code the implementation on internal_statvfs.c. The alpha is now unrequired, the generic implementation also handles it. Also, remove unused includes on internal_statvfs.c, and remove unused arguments on __internal_statvfs{64}. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* tst: Provide test for ppollLukasz Majewski2021-02-081-1/+1
| | | | | | | | | | | This change adds new test to assess ppoll()'s timeout related functionality (the struct pollfd does not provide valid fd to wait for - just wait for timeout). To be more specific - two use cases are checked: - if ppoll() times out immediately when passed struct timespec has zero values of tv_nsec and tv_sec. - if ppoll() times out after timeout specified in passed argument
* tst: Provide test for timerfd related functionsLukasz Majewski2021-02-081-1/+2
| | | | | | | This change adds new test to assess functionality of timerfd_* functions. It creates new timer (operates on its file descriptor) and checks if time before and after sleep is between expected values.
* io: Remove xmknod{at} implementationsAdhemerval Zanella2020-12-291-1/+2
| | | | | | | | | | With xmknod wrapper functions removed (589260cef8), the mknod functions are now properly exported, and version is done using symbols versioning instead of the extra _MKNOD_* argument. It also allows us to consolidate Linux and Hurd mknod implementation. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* io: Remove xstat implementationsAdhemerval Zanella2020-12-291-1/+3
| | | | | | | | With xstat wrapper functions removed (8ed005daf0), the stat functions are now properly exported, and version is done using symbols versioning instead of the extra _STAT_* argument. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* sysvipc: Fix IPC_INFO and SHM_INFO handling [BZ #26636]Adhemerval Zanella2020-10-141-1/+1
| | | | | | | | | | | | | | | Both commands are Linux extensions where the third argument is either a 'struct shminfo' (IPC_INFO) or a 'struct shm_info' (SHM_INFO) instead of 'struct shmid_ds'. And their information does not contain any time related fields, so there is no need to extra conversion for __IPC_TIME64. The regression testcase checks for Linux specifix SysV ipc message control extension. For SHM_INFO it tries to match the values against the tunable /proc values and for MSG_STAT/MSG_STAT_ANY it check if the create\ shared memory is within the global list returned by the kernel. Checked on x86_64-linux-gnu and on i686-linux-gnu (Linux v5.4 and on Linux v4.15).
* linux: Add {f}stat{at} y2038 supportAdhemerval Zanella2020-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | A new struct __stat{64}_t64 type is added with the required __timespec64 time definition. Only LFS is added, 64-bit time with 32-bit offsets is not supposed to be supported (no existing glibc configuration supports such a combination). It is done with an extra __NR_statx call plus a conversion to the new __stat{64}_t64 type. The statx call is done only for 32-bit time_t ABIs. Internally some extra routines to copy from/to struct stat{64} to struct __stat{64} used on multiple implementations (stat, fstat, lstat, and fstatat) are added on a extra implementation (stat_t64_cp.c). Alse some extra routines to copy from statx to __stat{64} is added on statx_cp.c. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* linux: Move the struct stat{64} to struct_stat.hAdhemerval Zanella2020-10-091-1/+2
| | | | | | | | | | | The common definitions are moved to a Linux generic stat.h while the struct stat{64} definition are moved to a arch-specific struct_stat.h header. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* nptl: Add missing cancellation flags on futex_internal and pselect32Adhemerval Zanella2020-10-071-0/+1
| | | | | | | It fixes the tst-cancelx{4,5} and tst-cancel24-{static} regression on some platforms (arm and sparc32). Checked on arm-linux-gnueabihf and sparcv9-linux-gnu.
* sysvipc: Fix IPC_INFO and MSG_INFO handling [BZ #26639]Adhemerval Zanella2020-10-021-1/+1
| | | | | | | | | | | | | | | | Both commands are Linux extensions where the third argument is a 'struct msginfo' instead of 'struct msqid_ds' and its information does not contain any time related fields (so there is no need to extra conversion for __IPC_TIME64. The regression testcase checks for Linux specifix SysV ipc message control extension. For IPC_INFO/MSG_INFO it tries to match the values against the tunable /proc values and for MSG_STAT/MSG_STAT_ANY it check if the create message queue is within the global list returned by the kernel. Checked on x86_64-linux-gnu and on i686-linux-gnu (Linux v5.4 and on Linux v4.15).
* sysvipc: Fix SEM_STAT_ANY kernel argument pass [BZ #26637]Dmitry V. Levin2020-10-021-1/+1
| | | | | | | | | | | | | | | | Handle SEM_STAT_ANY the same way as SEM_STAT so that the buffer argument of SEM_STAT_ANY is properly passed to the kernel and back. The regression testcase checks for Linux specifix SysV ipc message control extension. For IPC_INFO/SEM_INFO it tries to match the values against the tunable /proc values and for SEM_STAT/SEM_STAT_ANY it check if the create message queue is within the global list returned by the kernel. Checked on x86_64-linux-gnu and on i686-linux-gnu (Linux v5.4 and on Linux v4.15). Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* linux: Add time64 pselect supportAdhemerval Zanella2020-09-111-1/+1
| | | | | | | | | | | | | | | The syscall __NR_pselect6_time64 (32-bit) or __NR_pselect6 (64-bit) is used as default. For architectures with __ASSUME_TIME64_SYSCALLS the 32-bit fallback uses __NR_pselec6. To accomodate microblaze missing pselect6 support on kernel older than 3.15 the fallback is moved to its own function to the microblaze specific implementation can override it. Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15 kernel). Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* linux: Consolidate fxstatat{64}Adhemerval Zanella2020-09-111-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The LFS support is implemented on fxstat64.c, instead of fxstat.c for 64-bit architectures. The fxstatat.c implements the non-LFS and it is a no-op for !XSTAT_IS_XSTAT64. The generic non-LFS implementation handles two cases: 1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and nios): it issues __NR_fstatat64 plus handle the overflow on st_ino, st_size, or st_blocks. It only handles _STAT_VER_KERNEL. 2. Old kABIs with old non-LFS support (arm, i386, hppa, m68k, mips32, microblaze, s390, sh, powerpc, and sparc32). it issues __NR_fstatat64 and convert to non-LFS stat struct based on the version. Also non-LFS mips64 is an outlier and it has its own implementation since _STAT_VER_LINUX requires a different conversion function (it uses the kernel_stat as the sysissues argument since its exported ABI is different than the kernel one for both non-LFS and LFS implementation). The generic LFS implementation handles multiple cases: 1. XSTAT_IS_XSTAT64 being 1: 1.1. 64-bit kABI (aarch64, ia64, powerpc64*, s390x, riscv64, and x86_64): it issues __NR_newfstatat for _STAT_VER_KERNEL or _STAT_VER_LINUX. 1.2. 64-bit kABI outlier (sparc64): it issuess fstatat64 with a temporary stat64 and convert to output stat64 based on the input version (and using a sparc64 specific __xstat32_conv). 1.3. New 32-bit kABIs with only 64-bit time_t support (arc and riscv32): it issues __NR_statx and covert to struct stat64. 2. Old ABIs with XSTAT_IS_XSTAT64 being 0 (arm, csky, i386, hppa, m68k, microblaze, mips32, nios2, sh, powerpc32, and sparc32): it issues __NR_fstat64. Also, two special cases requires specific implementations: 1. alpha: it uses the __NR_fstatat64 syscall instead. 2. mips64: as for non-LFS implementation its ABIs differ from glibc exported one, which requires an specific conversion function to handle the kernel_stat. Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* linux: Add helper function to optimize 64-bit time_t fallback supportAdhemerval Zanella2020-08-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These helper functions are used to optimize the 64-bit time_t support on configurations that requires support for 32-bit time_t fallback (!__ASSUME_TIME64_SYSCALLS). The idea is once the kernel advertises that it does not have 64-bit time_t support, glibc will stop to try issue the 64-bit time_t syscall altogether. For instance: #ifndef __NR_symbol_time64 # define __NR_symbol_time64 __NR_symbol #endif int r; if (supports_time64 ()) { r = INLINE_SYSCALL_CALL (symbol, ...); if (r == 0 || errno != ENOSYS) return r; mark_time64_unsupported (); } #ifndef __ASSUME_TIME64_SYSCALLS <32-bit fallback syscall> #endif return r; On configuration with default 64-bit time_t this optimization should be optimized away by the compiler resulting in no overhead.
* Linux: Remove rseq supportFlorian Weimer2020-07-161-12/+3
| | | | | | | | | | | | | | | | | | The kernel ABI is not finalized, and there are now various proposals to change the size of struct rseq, which would make the glibc ABI dependent on the version of the kernels used for building glibc. This is of course not acceptable. This reverts commit 48699da1c468543ade14777819bd1b4d652709de ("elf: Support at least 32-byte alignment in static dlopen"), commit 8f4632deb3545b2949cec5454afc3cb21a0024ea ("Linux: rseq registration tests"), commit 6e29cb3f61ff5432c78a1c84b0d9b123a350ab36 ("Linux: Use rseq in sched_getcpu if available"), and commit 0c76fc3c2b346dc5401dc055d97d4279632b0fb3 ("Linux: Perform rseq registration at C startup and thread creation"), resolving the conflicts introduced by the ARC port and the TLS static surplus changes. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* linux: Fix syscall list generation instructionsMaciej W. Rozycki2020-07-091-1/+1
| | | | | | | | | | | Make the instructions for syscall list generation match Makefile and refer to `update-syscall-lists'; there has been no `update-arch-syscall' target. Also use single quotes around the command to stick to the ASCII character set. Fixes 4cf0d223052d ("Linux: Add tables with system call numbers"). Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
* sysvipc: Remove the linux shm-pad.h fileAdhemerval Zanella2020-07-091-1/+1
| | | | | | | | | | | | | | Each architecture overrides the struct msqid_ds which its required kernel ABI one. Checked on x86_64-linux-gnu and some bases sysvipc tests on hppa, mips, mipsle, mips64, mips64le, sparc64, sparcv9, powerpc64le, powerpc64, and powerpc. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* sysvipc: Split out linux struct shmid_dsAdhemerval Zanella2020-07-091-0/+1
| | | | | | | | | | | | This will allow us to have architectures specify their own version. Not semantic changes expected. Checked with a build against the all affected ABIs. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* sysvipc: Remove the linux msq-pad.h fileAdhemerval Zanella2020-07-091-1/+1
| | | | | | | | | | | | | | Each architecture overrides the struct msqid_ds which its required kernel ABI one. Checked on x86_64-linux-gnu and some bases sysvipc tests on hppa, mips, mipsle, mips64, mips64le, sparc64, sparcv9, powerpc64le, powerpc64, and powerpc. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Alistair Francis <alistair.francis@wdc.com>
* sysvipc: Split out linux struct semid_dsAdhemerval Zanella2020-07-091-0/+1
| | | | | | | | | | | | This will allow us to have architectures specify their own version. Not semantic changes expected. Checked with a build against the all affected ABIs. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Tested-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* Linux: rseq registration testsMathieu Desnoyers2020-07-061-1/+9
| | | | | | | | | | | | | | | These tests validate that rseq is registered from various execution contexts (main thread, destructor, other threads, other threads created from destructor, forked process (without exec), pthread_atfork handlers, pthread setspecific destructors, signal handlers, atexit handlers). tst-rseq.c only links against libc.so, testing registration of rseq in a non-multithreaded environment. tst-rseq-nptl.c also links against libpthread.so, testing registration of rseq in a multithreaded environment. See the Linux kernel selftests for extensive rseq stress-tests.
* Linux: Perform rseq registration at C startup and thread creationMathieu Desnoyers2020-07-061-2/+3
| | | | | | | | | | | | | | | | | | | Register rseq TLS for each thread (including main), and unregister for each thread (excluding main). "rseq" stands for Restartable Sequences. See the rseq(2) man page proposed here: https://lkml.org/lkml/2018/9/19/647 Those are based on glibc master branch commit 3ee1e0ec5c. The rseq system call was merged into Linux 4.18. The TLS_STATIC_SURPLUS define is increased to leave additional room for dlopen'd initial-exec TLS, which keeps elf/tst-auditmany working. The increase (76 bytes) is larger than 32 bytes because it has not been increased in quite a while. The cost in terms of additional TLS storage is quite significant, but it will also obscure some initial-exec-related dlopen failures.
* nptl: Replace some stubs with the Linux implementationFlorian Weimer2020-05-201-4/+1
| | | | | | | | | | | | | The stubs for pthread_getaffinity_np, pthread_getname_np, pthread_setaffinity_np, pthread_setname_np are replaced, and corresponding tests are moved. After the removal of the NaCl port, nptl is Linux-specific, and the stubs are no longer needed. This effectively reverts commit c76d1ff5149bd03210f2bb8cd64446c51618d016 ("NPTL: Add stubs for Linux-only extension functions."). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* y2038: linux: Provide __clock_adjtime64 implementationLukasz Majewski2020-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces auto generated wrapper (as described in sysdeps/unix/sysv/linux/syscalls.list) for clock_adjtime with one which adds extra support for reading 64 bit time values on machines with __TIMESIZE != 64. To achieve this goal new __clock_adjtime64 explicit 64 bit function for adjusting Linux clock has been added. Moreover, a 32 bit version - __clock_adjtime has been refactored to internally use __clock_adjtime64. The __clock_adjtime is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversions between 64 bit struct __timespec64 and struct timespec. The new __clock_adjtime64 syscall available from Linux 5.1+ has been used, when applicable. Up till v5.4 in the Linux kernel there was a bug preventing this call from obtaining correct struct's timex time.tv_sec time after time_t overflow (i.e. not being Y2038 safe). Build tests: - ./src/scripts/build-many-glibcs.py glibcs Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master Linux kernel, headers and minimal kernel version for glibc build test matrix: - Linux v5.1 (with clock_adjtime64) and glibc build with v5.1 as minimal kernel version (--enable-kernel="5.1.0") The __ASSUME_TIME64_SYSCALLS flag defined. - Linux v5.1 and default minimal kernel version The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports clock_adjtime64 syscall. - Linux v4.19 (no clock_adjtime64 support) with default minimal kernel version for contemporary glibc (3.2.0) This kernel doesn't support clock_adjtime64 syscall, so the fallback to clock_adjtime is tested. Above tests were performed with Y2038 redirection applied as well as without (so the __TIMESIZE != 64 execution path is checked as well). No regressions were observed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add a C wrapper for prctl [BZ #25896]H.J. Lu2020-04-301-1/+1
| | | | | | | | | | | | Add a C wrapper to pass arguments in /* Control process execution. */ extern int prctl (int __option, ...) __THROW; to prctl syscall: extern int prctl (int, unsigned long int, unsigned long int, unsigned long int, unsigned long int);
* Add C wrappers for process_vm_readv/process_vm_writev [BZ #25810]H.J. Lu2020-04-291-1/+2
| | | | | | Since the the U marker can only be applied to 2 unsigned long arguments in syscalls.list files, add a C wrapper for process_vm_readv and process_vm_writev syscals which have more than 2 unsigned long arguments.
* semctl: Remove the sem-pad.h fileAlistair Francis2020-04-291-1/+1
| | | | | | | Remove the sem-pad.h file and instead have architectures override the struct semid_ds via the bits/types/struct_semid_ds.h file. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* bits/sem.h: Split out struct semid_dsAlistair Francis2020-04-291-0/+1
| | | | | | | Split out the struct semid_ds into it's own file. This will allow us to have architectures specify their own version. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: Remove <sys/sysctl.h> and the sysctl functionFlorian Weimer2020-04-151-5/+3
| | | | | | | | | | | | | | | Linux 5.5 remove the system call in commit 61a47c1ad3a4dc6882f01ebdc88138ac62d0df03 ("Linux: Remove <sys/sysctl.h>"). Therefore, the compat function is just a stub that sets ENOSYS. Due to SHLIB_COMPAT, new ports will not add the sysctl function anymore automatically. x32 already lacks the sysctl function, so an empty sysctl.c file is used to suppress it. Otherwise, a new compat symbol would be added. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Linux: Add io/tst-o_path-locks testFlorian Weimer2020-02-091-1/+1
| | | | | | The O_PATH-based fchmodat emulation will rely on the fact that closing an O_PATH descriptor never releases POSIX advisory locks, so this commit adds a test case for this behavior.
* y2038: linux: Provide __timerfd_settime64 implementationLukasz Majewski2020-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces auto generated wrapper (as described in sysdeps/unix/sysv/linux/syscalls.list) for timerfd_settime with one which adds extra support for reading and writing from Linux kernel 64 bit time values on machines with __TIMESIZE != 64. There is no functional change for archs already supporting 64 bit time ABI. This patch is conceptually identical to timer_settime conversion already done in sysdeps/unix/sysv/linux/timer_settime.c. Please refer to corresponding commit message for detailed description of introduced functions and the testing procedure. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> --- Changes for v4: - Update date from 2019 to 2020 Changes for v3: - Add missing libc_hidden_def() Changes for v2: - Remove "Contributed by" from the file header - Remove early check for (fd < 0) in __timerfd_settime64 as the fd correctness check is already done in Linux kernel - Add single descriptive comment line to provide concise explanation of the code
* y2038: linux: Provide __timerfd_gettime64 implementationLukasz Majewski2020-02-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces auto generated wrapper (as described in sysdeps/unix/sysv/linux/syscalls.list) for timerfd_gettime with one which adds extra support for reading 64 bit time values on machines with __TIMESIZE != 64. There is no functional change for architectures already supporting 64 bit time ABI. This patch is conceptually identical to timer_gettime conversion already done in sysdeps/unix/sysv/linux/timer_gettime.c. Please refer to corresponding commit message for detailed description of introduced functions and the testing procedure. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> --- Changes for v4: - Update date from 2019 to 2020 Changes for v3: - Add missing libc_hidden_def() Changes for v2: - Remove "Contributed by" from the file header - Remove early check for (fd < 0) in __timerfd_gettime64 as the fd correctness check is already done in Linux kernel - Add single descriptive comment line to provide concise explanation of the code
* Linux: Add tables with system call numbersFlorian Weimer2020-01-021-12/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | The new tables are currently only used for consistency checks with the installed kernel headers and the architecture-independent system call names table. They are based on Linux 5.4. The goal is to use these architecture-specific tables to ensure that system call wrappers are available irrespective of the version of the installed kernel headers. The tables are formatted in the form of C header files so that they can be used directly in an #include directive, without external preprocessing. (External preprocessing of a plain table file would introduce cross-subdirectory dependency issues.) However, the intent is that they can still be treated as tables and can be processed by simple tools. The irregular system call names on 32-bit arm add a complication. The <fixup-asm-unistd.h> header is introduced to work around that, and the system calls are listed under regular names in the <arch-syscall.h> file. A make target, update-syscalls-list, is added to patch the glibc sources with data from the current kernel headers. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Remove __waitpid_nocancelAdhemerval Zanella2019-12-191-1/+1
| | | | | | | | | It enables and disables cancellation with pthread_setcancelstate before calling the waitpid. It simplifies the waitpid implementation for architectures that do not provide either __NR_waitpid or __NR_wait4. Checked on x86_64-linux-gnu.
* Remove pause and nanosleep not cancel wrappersAdhemerval Zanella2019-10-311-2/+2
| | | | | | Since they are not used any longer. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Linux/Alpha: don't use timeval32 system calls.Zack Weinberg2019-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux/Alpha has two versions of several system call wrappers that take or return data of type "struct timeval" (possibly nested inside a larger structure). The GLIBC_2.0 version is a compat symbol that calls __NR_osf_foo or __NR_old_foo and uses a struct timeval with a 32-bit tv_sec field. The GLIBC_2.1 version is used for current code, calls __NR_foo, and uses a struct timeval with a 64-bit tv_sec field. This patch changes all of the compat symbols of this type to be wrappers around their GLIBC_2.1 counterparts; the compatibility system calls will no longer be used. It serves as a proposal for part of how we do the transition to 64-bit time_t on systems that currently use 32-bit time_t: * The patched glibc will NOT use system calls that involve 32-bit time_t to implement its compatibility symbols. This will make both our lives and the kernel maintainers' lives easier. The primary argument I've seen against it is that the kernel could warn about uses of the old system calls, helping people find old binaries that need to be recompiled. I think there are several other ways we could accomplish this, e.g. scripts to scan the filesystem for binaries with references to the old symbol versions, or issuing diagnostics ourselves. * The compat symbols do NOT report failure after the Y2038 deadline. An earlier revision of this patch had them return -1 and set errno to EOVERFLOW, but Adhemerval pointed out that many of them have already performed side effects at the point where we discover the overflow, so that would break more than it fixes. Also, we don't want people to be _checking_ for EOVERFLOW from these functions; we want them to recompile with 64-bit time_t. So it's not actually useful for them to report failure to the calling code. * What they do do, when they encounter overflow, is saturate the overflowed "struct timeval"(s): tv_sec is set to INT32_MAX and tv_nsec is set to 999999. That means time stops advancing for programs with 32-bit time_t when they reach the deadline. That's obviously going to break stuff, but I think wrapping around is probably going to break _more_ stuff. I'd be interested to hear arguments against, if anyone has one. The new header file tv32-compat.h is currently Alpha-specific but I mean for it to be reused to aid in writing wrappers for all affected architectures. I only put it in sysdeps/unix/sysv/linux/alpha for now because I haven't checked whether the various "foo32" structures it defines agree with the ABI for ports other than Linux/Alpha. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add nocancel version of pread64()Leandro Pereira2019-10-181-2/+2
| | | | | | | This is in preparation for changes in the dynamic linker so that pread() is used instead of lseek()+read(). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* sysvipc: Set ipc_perm mode as mode_t (BZ#18231)Adhemerval Zanella2019-10-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch sets the mode field in ipc_perm as mode_t for all architectures, as POSIX specification [1]. The changes required are as follow: 1. It moves the ipc_perm definition out of ipc.h to its own header ipc_perm.h. It also allows consolidate the IPC_* definition on only one header. 2. The generic implementation follow the kernel ipc64_perm size so the syscall can be made directly without temporary buffer copy. However, since glibc defines the MODE field as mode_t, it omits the __PAD1 field (since glibc does not export mode_t as 16-bit for any architecture). It is a two-fold improvement: 2.1. New implementation which follow Linux UAPI will not need to provide an arch-specific ipc-perm.h header neither wrongly use the wrong 16-bit definition from previous default ipc.h (as csky did). 2.1. It allows consolidate ipc_perm definition for architectures that already provide mode_t as 32-bit. 3. All kernel ABIs for the supported architectures already provides the expected padding for mode type extension to 32-bit. However, some architectures the padding has the wrong placement, so it requires the ipc control routines (msgctl, semctl, and shmctl) to adjust the mode field accordingly. Currently they are armeb, microblaze, m68k, s390, and sheb. A new assume is added, __ASSUME_SYSVIPC_BROKEN_MODE_T, which the required ABIs define. 4. For the ABIs that define __ASSUME_SYSVIPC_BROKEN_MODE_T, it also require compat symbols that do not adjust the mode field. Checked on arm-linux-gnueabihf, aarch64-linux-gnu, powerpc64le-linux-gnu, and x86_64-linux-gnu. I also checked the sysvipc tests on hppa-linux-gnu, sh4-linux-gnu, s390x-linux-gnu, and s390-linux-gnu. I also did a sanity test against armeb qemu usermode for the sysvipc tests. [BZ #18231] * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add bits/ipc-perm.h. * sysdeps/unix/sysv/linux/aarch64/bits/ipc.h: Remove file. * sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/hppa/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/s390/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/ipc.h: Likewise. * sysdeps/unix/sysv/linux/arm/kernel-features.h [__BYTE_ORDER == __BIG_ENDIAN] (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/sysv/linux/microblaze/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h [!__s390x__] (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define. * sysdeps/unix/sysv/linux/m68k/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/bits/ipc-perm.h: New file. * sysdeps/unix/sysv/linux/powerpc/bits/ipc-perm.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/ipc-perm.h: Likewise. * sysdeps/unix/sysv/linux/bits/ipc.h (ipc_perm): Move to bits/ipc-perm.h. * sysdeps/unix/sysv/linux/hppa/bits/ipc-perm.h: New file. * sysdeps/unix/sysv/linux/kernel-features.h: Add comment about __ASSUME_SYSVIPC_BROKEN_MODE_T semantic. * sysdeps/unix/sysv/linux/msgctl.c (DEFAULT_VERSION): Define as 2.31 if __ASSUME_SYSVIPC_BROKEN_MODE_T is defined. (msgctl_syscall, __msgctl_mode16): New symbol. (__new_msgctl): Add bits for __ASSUME_SYSVIPC_BROKEN_MODE_T. * sysdeps/unix/sysv/linux/semctl.c: Likewise. * sysdeps/unix/sysv/linux/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/arm/be/libc.abilist (GLIBC_2.31): Add msgctl, semctl, and shmctl. * sysdeps/sysv/linux/microblaze/be/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/be/libc.abilist: Likewise. * conform/data/sys/ipc.h-data: Only xfail {struct ipc_perm} mode_t mode for Hurd. * sysdeps/unix/sysv/linux/m68k/Versions (libc) [GLIBC_2.31]: Add msgctl, semctl, and shmctl. * sysdeps/unix/sysv/linux/arm/be/Versions: New file. * sysdeps/unix/sysv/linux/microblaze/be/Versions: Likewise. * sysdeps/unix/sysv/linux/sh/be/Versions: Likewise. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_ipc.h.html