24
24
/* The include_next requires a split double-inclusion guard. */
25
#@INCLUDE_NEXT@ @NEXT_DIRENT_H@
26
# @INCLUDE_NEXT@ @NEXT_DIRENT_H@
29
#ifndef _@GUARD_PREFIX@_DIRENT_H
30
#define _@GUARD_PREFIX@_DIRENT_H
30
32
/* Get ino_t. Needed on some systems, including glibc 2.8. */
31
33
#include <sys/types.h>
36
/* Define types DIR and 'struct dirent'. */
37
# if !GNULIB_defined_struct_dirent
43
/* Possible values for 'd_type'. */
45
# define DT_FIFO 1 /* FIFO */
46
# define DT_CHR 2 /* character device */
47
# define DT_DIR 4 /* directory */
48
# define DT_BLK 6 /* block device */
49
# define DT_REG 8 /* regular file */
50
# define DT_LNK 10 /* symbolic link */
51
# define DT_SOCK 12 /* socket */
52
# define DT_WHT 14 /* whiteout */
53
typedef struct gl_directory DIR;
54
# define GNULIB_defined_struct_dirent 1
58
/* The __attribute__ feature is available in gcc versions 2.5 and later.
59
The attribute __pure__ was added in gcc 2.96. */
60
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
61
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
63
# define _GL_ATTRIBUTE_PURE /* empty */
33
66
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
35
68
/* The definition of _GL_ARG_NONNULL is copied here. */
40
73
/* Declare overridden functions. */
42
#if @REPLACE_CLOSEDIR@
43
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
44
# define closedir rpl_closedir
46
_GL_FUNCDECL_RPL (closedir, int, (DIR *) _GL_ARG_NONNULL ((1)));
47
_GL_CXXALIAS_RPL (closedir, int, (DIR *));
49
_GL_CXXALIAS_SYS (closedir, int, (DIR *));
76
# if @REPLACE_OPENDIR@
77
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
79
# define opendir rpl_opendir
81
_GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
82
_GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
85
_GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
87
_GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name));
89
_GL_CXXALIASWARN (opendir);
90
#elif defined GNULIB_POSIXCHECK
92
# if HAVE_RAW_DECL_OPENDIR
93
_GL_WARN_ON_USE (opendir, "opendir is not portable - "
94
"use gnulib module opendir for portability");
100
_GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1)));
102
_GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp));
103
_GL_CXXALIASWARN (readdir);
104
#elif defined GNULIB_POSIXCHECK
106
# if HAVE_RAW_DECL_READDIR
107
_GL_WARN_ON_USE (readdir, "readdir is not portable - "
108
"use gnulib module readdir for portability");
112
#if @GNULIB_REWINDDIR@
113
# if !@HAVE_REWINDDIR@
114
_GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1)));
116
_GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp));
117
_GL_CXXALIASWARN (rewinddir);
118
#elif defined GNULIB_POSIXCHECK
120
# if HAVE_RAW_DECL_REWINDDIR
121
_GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - "
122
"use gnulib module rewinddir for portability");
126
#if @GNULIB_CLOSEDIR@
127
# if @REPLACE_CLOSEDIR@
128
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
130
# define closedir rpl_closedir
132
_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
133
_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
135
# if !@HAVE_CLOSEDIR@
136
_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
138
_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
51
140
_GL_CXXALIASWARN (closedir);
141
#elif defined GNULIB_POSIXCHECK
143
# if HAVE_RAW_DECL_CLOSEDIR
144
_GL_WARN_ON_USE (closedir, "closedir is not portable - "
145
"use gnulib module closedir for portability");
53
149
#if @GNULIB_DIRFD@
54
150
/* Return the file descriptor associated with the given directory stream,
112
#if @REPLACE_OPENDIR@
113
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
114
# define opendir rpl_opendir
116
_GL_FUNCDECL_RPL (opendir, DIR *, (const char *) _GL_ARG_NONNULL ((1)));
117
_GL_CXXALIAS_RPL (opendir, DIR *, (const char *));
119
_GL_CXXALIAS_SYS (opendir, DIR *, (const char *));
121
_GL_CXXALIASWARN (opendir);
123
208
#if @GNULIB_SCANDIR@
124
209
/* Scan the directory DIR, calling FILTER on each directory entry.
125
210
Entries for which FILTER returns nonzero are individually malloc'd,