mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-04 19:00:09 +00:00
942de61a89
This patch consolidates Linux readdir{64}{_r} implementation on just the default sysdeps/unix/sysv/linux/readdir{64}{_r}.c ones. The default implementation handle the Linux requirements: * readdir{_r} is only built for _DIRENT_MATCHES_DIRENT64 being 0. * readdir64{_r} is always built and aliased to readdir{_r} for ABI that define _DIRENT_MATCHES_DIRENT64. * A compat symbol is added for readdir64{_r} for ABI that used to export the old non-LFS version. Checked on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu, sparcv9-linux-gnu, sparc64-linux-gnu, powerpc-linux-gnu, and powerpc64le-linux-gnu. * sysdeps/posix/readdir.c (__READDIR, __GETDENTS, DIRENTY_TYPE, __READDIR_ALIAS): Undefine after usage. * sysdeps/posix/readdir_r.c (__READDIR_R, __GETDENTS, DIRENT_TYPE, __READDIR_R_ALIAS): Likewise. * sysdeps/unix/sysv/linux/arm/readdir64.c: Remove file. * sysdeps/unix/sysv/linux/arm/readdir64_r.c: Likewise. * sysdeps/unix/sysv/linux/m68k/readdir64.c: Likewise. * sysdeps/unix/sysv/linux/m68k/readdir64_r.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/readdir64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/readdir64_r.c: Likewise. * sysdeps/unix/sysv/linux/i386/readdir64.c: Likewise. * sysdeps/unix/sysv/linux/i386/readdir64_r.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/readdir64.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/readdir64_r.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/readdir.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/readdir64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/readdir64_r.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c: Likewise. * sysdeps/unix/sysv/linux/readdir.c: New file. * sysdeps/unix/sysv/linux/readdir_r.c: Likewise. * sysdeps/unix/sysv/linux/readdir64.c: Add compat symbol if required. * sysdeps/unix/sysv/linux/readdir64_r.c: Likewise.
56 lines
2.1 KiB
C
56 lines
2.1 KiB
C
/* Read a directory. Linux LFS version.
|
|
Copyright (C) 1997-2018 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
/* When _DIRENT_MATCHES_DIRENT64 is defined we can alias 'readdir64' to
|
|
'readdir'. However the function signatures are not equal due
|
|
different return types, so we need to suppress {__}readdir so weak
|
|
and strong alias do not throw conflicting types errors. */
|
|
#define readdir __no_readdir_decl
|
|
#define __readdir __no___readdir_decl
|
|
#include <dirent.h>
|
|
|
|
#define __READDIR __readdir64
|
|
#define __GETDENTS __getdents64
|
|
#define DIRENT_TYPE struct dirent64
|
|
|
|
#include <sysdeps/posix/readdir.c>
|
|
|
|
#undef __readdir
|
|
#undef readdir
|
|
|
|
libc_hidden_def (__readdir64)
|
|
#if _DIRENT_MATCHES_DIRENT64
|
|
strong_alias (__readdir64, __readdir)
|
|
weak_alias (__readdir64, readdir64)
|
|
weak_alias (__readdir64, readdir)
|
|
#else
|
|
/* The compat code expects the 'struct direct' with d_ino being a __ino_t
|
|
instead of __ino64_t. */
|
|
# include <shlib-compat.h>
|
|
versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
|
|
# if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
|
|
# include <olddirent.h>
|
|
# define __READDIR attribute_compat_text_section __old_readdir64
|
|
# define __GETDENTS __old_getdents64
|
|
# define DIRENT_TYPE struct __old_dirent64
|
|
# include <sysdeps/posix/readdir.c>
|
|
libc_hidden_def (__old_readdir64)
|
|
compat_symbol (libc, __old_readdir64, readdir64, GLIBC_2_1);
|
|
# endif /* SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) */
|
|
#endif /* _DIRENT_MATCHES_DIRENT64 */
|