1/* Read a directory. Linux LFS version.
2 Copyright (C) 1997-2018 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19/* When _DIRENT_MATCHES_DIRENT64 is defined we can alias 'readdir64' to
20 'readdir'. However the function signatures are not equal due
21 different return types, so we need to suppress {__}readdir so weak
22 and strong alias do not throw conflicting types errors. */
23#define readdir __no_readdir_decl
24#define __readdir __no___readdir_decl
25#include <dirent.h>
26
27#define __READDIR __readdir64
28#define __GETDENTS __getdents64
29#define DIRENT_TYPE struct dirent64
30
31#include <sysdeps/posix/readdir.c>
32
33#undef __readdir
34#undef readdir
35
36libc_hidden_def (__readdir64)
37#if _DIRENT_MATCHES_DIRENT64
38strong_alias (__readdir64, __readdir)
39weak_alias (__readdir64, readdir64)
40weak_alias (__readdir64, readdir)
41#else
42/* The compat code expects the 'struct direct' with d_ino being a __ino_t
43 instead of __ino64_t. */
44# include <shlib-compat.h>
45versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
46# if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
47# include <olddirent.h>
48# define __READDIR attribute_compat_text_section __old_readdir64
49# define __GETDENTS __old_getdents64
50# define DIRENT_TYPE struct __old_dirent64
51# include <sysdeps/posix/readdir.c>
52libc_hidden_def (__old_readdir64)
53compat_symbol (libc, __old_readdir64, readdir64, GLIBC_2_1);
54# endif /* SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) */
55#endif /* _DIRENT_MATCHES_DIRENT64 */
56