aboutsummaryrefslogtreecommitdiff
path: root/io
AgeCommit message (Collapse)Author
2021-06-10io: Fix sporadic test failures in io/tst-statFlorian Weimer
support_stat_nanoseconds cannot restore the ctime time, and this may lead to sporadic test failures. Therefore, probe for nanoseconds support before the initial statx call. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-06-02Add missing symbols to Version filesFlorian Weimer
Some symbols have explicit versioned_symbol or compat_symbol markers in the sources, but no corresponding entry in the Versions files. This presently works because the local: * directive is only applied to the base version. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-05-06Annotate additional APIs with GCC attribute access.Martin Sebor
This change continues the improvements to compile-time out of bounds checking by decorating more APIs with either attribute access, or by explicitly providing the array bound in APIs such as tmpnam() that expect arrays of some minimum size as arguments. (The latter feature is new in GCC 11.) The only effects of the attribute and/or the array bound is to check and diagnose calls to the functions that fail to provide a sufficient number of elements, and the definitions of the functions that access elements outside the specified bounds. (There is no interplay with _FORTIFY_SOURCE here yet.) Tested with GCC 7 through 11 on x86_64-linux.
2021-04-15io: Use temporary directory and file for ftwtest-shAdhemerval Zanella
It allows run it in parallel. Checked on x86_64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2021-04-15io: Add basic tests for utimensatAdhemerval Zanella
Checked on x86_64-linux-gnu and i686-linux-gnu Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2021-04-15linux: Add lutimes testAdhemerval Zanella
It uses stat to compare against the values set by lutimes. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2021-04-15linux: Add futimes testAdhemerval Zanella
It uses stat to compare against the values set by futimes. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2021-04-15io: Move file timestamps tests out of LinuxAdhemerval Zanella
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>
2021-04-07sys: Fixes possible typo in comment: statfs -> statvfsHugo Gabriel Eyherabide
2021-04-01socket: Add CFLAGS-accept.c and CFLAGS-connect.cAdhemerval Zanella
The c59f716993 (accept) and 3ddf9bc185 (connect) added on io/Makefile instead of socket/Makefile. Checked on arm-linux-gnueabihf (where without the flags both the tst-cancelx4 and tst-cancelx5 fails).
2021-03-31io: fix spelling typo in diagnosticPaul Eggert
2021-03-31io: Check at runtime if timestamp supports nanosecondsAdhemerval Zanella
Now that non-LFS stat function is implemented on to on LFS, it will use statx when available. It allows to check for nanosecond timestamp if the kernel supports __NR_statx. Checked on s390-linux-gnu with 4.12.14 kernel.
2021-03-26S390: Don't test nanoseconds in io/tst-stat.cStefan Liebler
Both new tests io/tst-stat and io/tst-stat-lfs (_FILE_OFFSET_BITS=64) are comparing the nanosecond fields with the statx result. Unfortunately on s390(31bit) those fields are always zero if old KABI with non-LFS support is used. With _FILE_OFFSET_BITS=64 stat is using statx internally. As suggested by Adhemerval this patch disables the nanosecond check for s390(31bit). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-03-18nptl: Remove connect from libpthreadAdhemerval Zanella
The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
2021-03-18nptl: Remove accept from libpthreadAdhemerval Zanella
The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
2021-03-18nptl: Remove close from libpthreadAdhemerval Zanella
The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
2021-03-18nptl: Remove read from libpthreadAdhemerval Zanella
The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
2021-03-18nptl: Remove write from libpthreadAdhemerval Zanella
The libc version is identical and built with same flags. Checked on x86_64-linux-gnu.
2021-03-11io: Return EBAFD for negative file descriptor on fstat (BZ #27559)Adhemerval Zanella
Now that fstat is implemented on top fstatat we need to handle negative inputs. The implementation now rejects AT_FDCWD, which would otherwise be accepted by the kernel. Checked on x86_64-linux-gnu and on i686-linux-gnu.
2021-01-11Update STATX_ATTR_DAX value from Linux 5.10.Joseph Myers
This patch updates the value of STATX_ATTR_DAX in bits/statx-generic.h for a change made in Linux 5.10. (As with previous such changes, this only does anything if glibc is being used with old kernel headers.) Tested for x86_64.
2021-01-02Update copyright dates with scripts/update-copyrightsPaul Eggert
I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
2020-12-31nonstring: Enable __FORTIFY_LEVEL=3Siddhesh Poyarekar
Use __builtin_dynamic_object_size in the remaining functions that don't have compiler builtins as is the case for string functions.
2020-12-29io: Remove xmknod{at} implementationsAdhemerval Zanella
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>
2020-12-29io: Remove xstat implementationsAdhemerval Zanella
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>
2020-11-26io: nftw/ftw: Fix stack overflow with large nopenfd [BZ #26353]Xiaoming Ni
The nopenfd value is used as argument for the internal buffer on ftw_statup, which is allocated with alloca and might trigger a stack overflow for large values. This patch replaces the memory allocation to use malloc instead. Checked on x86_64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-11-13Remove tls.h inclusion from internal errno.hAdhemerval Zanella
The tls.h inclusion is not really required and limits possible definition on more arch specific headers. This is a cleanup to allow inline functions on sysdep.h, more specifically on i386 and ia64 which requires to access some tls definitions its own. No semantic changes expected, checked with a build against all affected ABIs.
2020-10-09Remove mknod wrapper functions, move them to symbolsAdhemerval Zanella
This patch removes the mknod and mknodat static wrapper and add the symbols on the libc with the expected names. Both the prototypes of the internal symbol linked by the static wrappers and the inline redirectors are also removed from the installed sys/stat.h header file. The wrapper implementation license LGPL exception is also removed since it is no longer statically linked to binaries. Internally the _STAT_VER* definitions are moved to the arch-specific xstatver.h file. 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>
2020-10-09Remove stat wrapper functions, move them to exported symbolsAdhemerval Zanella
This patch removes the stat, stat64, lstat, lstat64, fstat, fstat64, fstatat, and fstatat64 static wrapper and add the symbol on the libc with the expected names. Both the prototypes of the internal symbol linked by the static wrappers and the inline redirectors are also removed from the installed sys/stat.h header file. The wrapper implementation license LGPL exception is also removed since it is no longer statically linked to binaries. Internally the _STAT_VER* definitions are moved to a arch-specific xstatver.h file. The internal defines that redirects internals {f}stat{at} to their {f}xstat{at} counterparts are removed for Linux (!NO_RTLD_HIDDEN). Hurd still requires them since {f}stat{at} pulls extra objects that makes the loader build fail otherwise (I haven't dig into why exactly). 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>
2020-10-08nptl: Add missing cancellation flags on lockfAdhemerval Zanella
It also removes CFLAGS-lockf.c duplicate rule. It fixes nptl/tst-cancelx16 on mips64-linux-gnu.
2020-09-11Remove internal usage of extensible stat functionsAdhemerval Zanella
It replaces the internal usage of __{f,l}xstat{at}{64} with the __{f,l}stat{at}{64}. It should not change the generate code since sys/stat.h explicit defines redirections to internal calls back to xstat* symbols. Checked with a build for all affected ABIs. I also check on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-09-02linux: Remove __ASSUME_ATFCTSAdhemerval Zanella
The __have_atfcts is not used anywhere. Checked on x86_64-linux-gnu.
2020-08-27io/lockf: Include bits/types.h before __OFF_T_MATCHES_OFF64_T checkAlistair Francis
It's possible that although __OFF_T_MATCHES_OFF64_T is defined the included the relevent header file. This results in a io/tst-lockf failure for RV32 by calling the non 64-bit version of lockf. This patch fixes the failure by including bits/types.h. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-08-20Fix namespace violation in stdio.h and sys/stat.h if build with ↵Stefan Liebler
optimization. [BZ #26376] If build with optimization, stdio.h and sys/stat.h are defining some inlining functions. This leads to test fails if glibc is build with the following commands. (Note that the conformtests usually builds without optimization or other CFLAGS): <glibc>/configure CC="gcc -O3" --prefix=/usr make make subdirs=conform check - FAIL: conform/XPG4/stdio.h/conform - FAIL: conform/XPG42/stdio.h/conform out-files: ... PASSCOMBINED: Availability of variable optopt PASSCOMBINED: Type of variable optopt Namespace violation: "getc_unlocked" Namespace violation: "getchar_unlocked" Namespace violation: "putc_unlocked" Namespace violation: "putchar_unlocked" FAIL: Namespace of <stdio.h> ---------------------------------------------------------------------------- Total number of tests : 168 Number of failed tests : 1 Number of xfailed tests : 0 Number of skipped tests : 0 - FAIL: conform/POSIX2008/sys/stat.h/conform out-file: ... PASSCOMBINED: Availability of function utimensat PASSCOMBINED: Type of function utimensat Namespace violation: "mknodat" FAIL: Namespace of <sys/stat.h> ---------------------------------------------------------------------------- Total number of tests : 97 Number of failed tests : 1 Number of xfailed tests : 0 Number of skipped tests : 0 For getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked in stdio.h, those are defined "# ifdef __USE_POSIX" instead of "#ifdef __USE_POSIX199506" for the non-inlining declaration. See also "Bug 20014 - stdio.h namespace for pre-threads POSIX" (https://sourceware.org/bugzilla/show_bug.cgi?id=20014). For mknodat in sys/stat.h, those are defined "# ifdef __USE_ATFILE" instead of the additional guard "# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED".
2020-08-19Add new STATX_* constants from Linux 5.8 to bits/statx-generic.h.Joseph Myers
This patch adds the new STATX_MNT_ID, STATX_ATTR_MOUNT_ROOT and STATX_ATTR_DAX macros from Linux 5.8 to glibc's bits/statx-generic.h. (As with previous such changes, this only does anything if glibc is being used with old kernel headers.) A comment in the Linux kernel headers indicates that STATX_ALL is deliberately not being changed. Tested for x86_64.
2020-05-11Suppress GCC 10 true positive warnings [BZ #25967]Martin Sebor
Suppress or avoid warnings in tests that exercise failure modes by making calls with invalid arguments. Reviewed-by: DJ Delorie <dj@redhat.com> Reviewed-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Joseph Myers <joseph@codesourcery.com>
2020-02-18Linux: Work around kernel bugs in chmod on /proc/self/fd paths [BZ #14578]Florian Weimer
It appears that the ability to change symbolic link modes through such paths is unintended. On several file systems, the operation fails with EOPNOTSUPP, even though the symbolic link permissions are updated. The expected behavior is a failure to update the permissions, without file system changes. Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
2020-02-18Move implementation of <file_change_detection.h> into a C fileFlorian Weimer
file_change_detection_for_stat partially initialize struct file_change_detection in some cases, when the size member alone determines the outcome of all comparisons. This results in maybe-uninitialized compiler warnings in case of sufficiently aggressive inlining. Once the implementation is moved into a separate C file, this kind of inlining is no longer possible, so the compiler warnings are gone.
2020-02-13Add STATX_ATTR_VERITY from Linux 5.5 to bits/statx-generic.h.Joseph Myers
This patch adds the new STATX_ATTR_VERITY macro from Linux 5.5 to glibc's bits/statx-generic.h. (This only does anything if glibc is being used with old kernel headers.) Tested for x86_64.
2020-02-12io: Add io/tst-lchmod covering lchmod and fchmodatFlorian Weimer
2020-02-12io: Implement lchmod using fchmodat [BZ #14578]Florian Weimer
2020-02-12Add internal <file_change_detection.h> header fileFlorian Weimer
The code started out with bits form resolv/resolv_conf.c, but it was enhanced to deal with directories and FIFOs in a more predictable manner. A test case is included as well. This will be used to implement the /etc/resolv.conf change detection. This currently lives in a header file only. Once there are multiple users, the implementations should be moved into C files.
2020-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
2019-12-01hurd: Fix ld.so __access override from libcSamuel Thibault
ld.so symbols to be overriden by libc need to be extern to really get overriden. __access happens to have never been exposed, putting it to GLIBC_PRIVATE.
2019-12-01hurd: Fix ld.so __getcwd override from libcSamuel Thibault
ld.so symbols to be overriden by libc need to be extern to really get overriden. __getcwd happens to have never been exposed, putting it to GLIBC_PRIVATE.
2019-10-27time: Introduce function to check correctness of nanoseconds valueLukasz Majewski
The valid_nanoseconds () static inline function has been introduced to check if nanoseconds value is in the correct range - greater or equal to zero and less than 1000000000. The explicit #include <time.h> has been added to files where it was missing. The __syscall_slong_t type for ns has been used to avoid issues on x32. Tested with: - scripts/build-many-glibcs.py - make PARALLELMFLAGS="-j12" && make PARALLELMFLAGS="-j12" xcheck on x86_64
2019-09-07Prefer https to http for gnu.org and fsf.org URLsPaul Eggert
Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-08-06Add AT_RECURSIVE from Linux 5.2 to fcntl.h.Joseph Myers
This patch adds the AT_RECURSIVE constant from Linux 5.2 to glibc's fcntl.h. (Existing practice in glibc is that the AT_* constants go directly in io/fcntl.h rather than somewhere OS-specific.) Tested for x86_64. * io/fcntl.h [__USE_GNU] (AT_RECURSIVE): New macro.
2019-07-08nftw: fill in stat buf for dangling links [BZ #23501]DJ Delorie
As per Austin Group interpretation, "the object" wrt a dangling symlink is the symlink itself, despite FTW_PHYS. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2019-06-28io: Remove copy_file_range emulation [BZ #24744]Florian Weimer
The kernel is evolving this interface (e.g., removal of the restriction on cross-device copies), and keeping up with that is difficult. Applications which need the function should run kernels which support the system call instead of relying on the imperfect glibc emulation. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-06-12<sys/stat.h>: Use Linux UAPI header for statx if available and usefulFlorian Weimer
This will automatically import new STATX_* constants. It also avoids a conflict between <sys/stat.h> and <linux/stat.h>.