glibc/include/dirent.h
Samuel Thibault 3d3316b1de hurd: keep only required PLTs in ld.so
We need NO_RTLD_HIDDEN because of the need for PLT calls in ld.so.
See Roland's comment in
https://sourceware.org/bugzilla/show_bug.cgi?id=15605
"in the Hurd it's crucial that calls like __mmap be the libc ones
instead of the rtld-local ones after the bootstrap phase, when the
dynamic linker is being used for dlopen and the like."

We used to just avoid all hidden use in the rtld ; this commit switches to
keeping only those that should use PLT calls, i.e. essentially those defined in
sysdeps/mach/hurd/dl-sysdep.c:

__assert_fail
__assert_perror_fail
__*stat64
_exit

This fixes a few startup issues, notably the call to __tunable_get_val that is
made before PLTs are set up.
2020-11-11 02:36:22 +01:00

90 lines
2.9 KiB
C

#ifndef _DIRENT_H
# ifndef _ISOMAC
# include <dirstream.h>
# endif
# include <dirent/dirent.h>
# ifndef _ISOMAC
# include <sys/stat.h>
# include <stdbool.h>
struct scandir_cancel_struct
{
DIR *dp;
void *v;
size_t cnt;
};
/* Now define the internal interfaces. */
extern DIR *__opendir (const char *__name) attribute_hidden;
extern DIR *__opendirat (int dfd, const char *__name) attribute_hidden;
extern DIR *__fdopendir (int __fd) attribute_hidden;
extern int __closedir (DIR *__dirp) attribute_hidden;
extern struct dirent *__readdir (DIR *__dirp) attribute_hidden;
extern struct dirent *__readdir_unlocked (DIR *__dirp) attribute_hidden;
extern struct dirent64 *__readdir64 (DIR *__dirp);
libc_hidden_proto (__readdir64)
extern int __readdir_r (DIR *__dirp, struct dirent *__entry,
struct dirent **__result);
extern int __readdir64_r (DIR *__dirp, struct dirent64 *__entry,
struct dirent64 **__result);
extern int __scandir64 (const char * __dir,
struct dirent64 *** __namelist,
int (*__selector) (const struct dirent64 *),
int (*__cmp) (const struct dirent64 **,
const struct dirent64 **));
extern __ssize_t __getdirentries (int __fd, char *__restrict __buf,
size_t __nbytes,
__off_t *__restrict __basep)
__THROW __nonnull ((2, 4));
/* These functions are only implemented on Linux. */
extern __ssize_t __getdents (int __fd, void *__buf, size_t __nbytes)
attribute_hidden;
extern __ssize_t __getdents64 (int __fd, void *__buf, size_t __nbytes);
libc_hidden_proto (__getdents64)
extern int __alphasort64 (const struct dirent64 **a, const struct dirent64 **b)
__attribute_pure__;
extern int __versionsort64 (const struct dirent64 **a,
const struct dirent64 **b)
__attribute_pure__;
extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
const struct stat64 *statp)
__nonnull (4) attribute_hidden;
extern __typeof (rewinddir) __rewinddir;
extern __typeof (seekdir) __seekdir;
extern __typeof (dirfd) __dirfd;
libc_hidden_proto (dirfd);
extern void __scandir_cancel_handler (void *arg) attribute_hidden;
extern int __scandir_tail (DIR *dp,
struct dirent ***namelist,
int (*select) (const struct dirent *),
int (*cmp) (const struct dirent **,
const struct dirent **))
attribute_hidden;
# if !_DIRENT_MATCHES_DIRENT64
extern int __scandir_tail (DIR *dp,
struct dirent ***namelist,
int (*select) (const struct dirent *),
int (*cmp) (const struct dirent **,
const struct dirent **))
attribute_hidden;
# endif
extern int __scandir64_tail (DIR *dp,
struct dirent64 ***namelist,
int (*select) (const struct dirent64 *),
int (*cmp) (const struct dirent64 **,
const struct dirent64 **))
attribute_hidden;
libc_hidden_proto (__rewinddir)
extern __typeof (scandirat) __scandirat;
# if IS_IN (rtld)
extern __typeof (__rewinddir) __rewinddir attribute_hidden;
# endif
# endif
#endif