This source file includes following definitions.
- _gl_register_dirp_fd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #ifndef _@GUARD_PREFIX@_DIRENT_H
18
19 #if __GNUC__ >= 3
20 @PRAGMA_SYSTEM_HEADER@
21 #endif
22 @PRAGMA_COLUMNS@
23
24
25 #if @HAVE_DIRENT_H@
26 # @INCLUDE_NEXT@ @NEXT_DIRENT_H@
27 #endif
28
29 #ifndef _@GUARD_PREFIX@_DIRENT_H
30 #define _@GUARD_PREFIX@_DIRENT_H
31
32
33 #include <sys/types.h>
34
35 #if !@HAVE_DIRENT_H@
36
37 # if !GNULIB_defined_struct_dirent
38 struct dirent
39 {
40 char d_type;
41 char d_name[1];
42 };
43
44 # define DT_UNKNOWN 0
45 # define DT_FIFO 1
46 # define DT_CHR 2
47 # define DT_DIR 4
48 # define DT_BLK 6
49 # define DT_REG 8
50 # define DT_LNK 10
51 # define DT_SOCK 12
52 # define DT_WHT 14
53 typedef struct gl_directory DIR;
54 # define GNULIB_defined_struct_dirent 1
55 # endif
56 #endif
57
58
59
60
61 #ifndef _GL_ATTRIBUTE_DEALLOC
62 # if __GNUC__ >= 11
63 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
64 # else
65 # define _GL_ATTRIBUTE_DEALLOC(f, i)
66 # endif
67 #endif
68
69
70
71
72 #ifndef _GL_ATTRIBUTE_MALLOC
73 # if __GNUC__ >= 3 || defined __clang__
74 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
75 # else
76 # define _GL_ATTRIBUTE_MALLOC
77 # endif
78 #endif
79
80
81
82 #ifndef _GL_ATTRIBUTE_PURE
83 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
84 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
85 # else
86 # define _GL_ATTRIBUTE_PURE
87 # endif
88 #endif
89
90
91
92
93
94
95
96
97
98
99 #if @GNULIB_CLOSEDIR@
100 # if @REPLACE_CLOSEDIR@
101 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
102 # undef closedir
103 # define closedir rpl_closedir
104 # define GNULIB_defined_closedir 1
105 # endif
106 _GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
107 _GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
108 # else
109 # if !@HAVE_CLOSEDIR@
110 _GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
111 # endif
112 _GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
113 # endif
114 _GL_CXXALIASWARN (closedir);
115 #elif defined GNULIB_POSIXCHECK
116 # undef closedir
117 # if HAVE_RAW_DECL_CLOSEDIR
118 _GL_WARN_ON_USE (closedir, "closedir is not portable - "
119 "use gnulib module closedir for portability");
120 # endif
121 #endif
122
123 #if @GNULIB_OPENDIR@
124 # if @REPLACE_OPENDIR@
125 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
126 # undef opendir
127 # define opendir rpl_opendir
128 # define GNULIB_defined_opendir 1
129 # endif
130 _GL_FUNCDECL_RPL (opendir, DIR *,
131 (const char *dir_name)
132 _GL_ARG_NONNULL ((1))
133 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
134 _GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
135 # else
136 # if !@HAVE_OPENDIR@ || __GNUC__ >= 11
137 _GL_FUNCDECL_SYS (opendir, DIR *,
138 (const char *dir_name)
139 _GL_ARG_NONNULL ((1))
140 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
141 # endif
142 _GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name));
143 # endif
144 _GL_CXXALIASWARN (opendir);
145 #else
146 # if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined opendir
147
148
149 _GL_FUNCDECL_SYS (opendir, DIR *,
150 (const char *dir_name)
151 _GL_ARG_NONNULL ((1))
152 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
153 # endif
154 # if defined GNULIB_POSIXCHECK
155 # undef opendir
156 # if HAVE_RAW_DECL_OPENDIR
157 _GL_WARN_ON_USE (opendir, "opendir is not portable - "
158 "use gnulib module opendir for portability");
159 # endif
160 # endif
161 #endif
162
163 #if @GNULIB_READDIR@
164 # if !@HAVE_READDIR@
165 _GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1)));
166 # endif
167 _GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp));
168 _GL_CXXALIASWARN (readdir);
169 #elif defined GNULIB_POSIXCHECK
170 # undef readdir
171 # if HAVE_RAW_DECL_READDIR
172 _GL_WARN_ON_USE (readdir, "readdir is not portable - "
173 "use gnulib module readdir for portability");
174 # endif
175 #endif
176
177 #if @GNULIB_REWINDDIR@
178 # if !@HAVE_REWINDDIR@
179 _GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1)));
180 # endif
181 _GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp));
182 _GL_CXXALIASWARN (rewinddir);
183 #elif defined GNULIB_POSIXCHECK
184 # undef rewinddir
185 # if HAVE_RAW_DECL_REWINDDIR
186 _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - "
187 "use gnulib module rewinddir for portability");
188 # endif
189 #endif
190
191 #if @GNULIB_DIRFD@
192
193
194 # if @REPLACE_DIRFD@
195
196 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) || defined dirfd
197 # undef dirfd
198 # define dirfd rpl_dirfd
199 # endif
200 _GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
201 _GL_CXXALIAS_RPL (dirfd, int, (DIR *));
202
203 # ifdef __KLIBC__
204
205 _GL_EXTERN_C int _gl_register_dirp_fd (int fd, DIR *dirp)
206 _GL_ARG_NONNULL ((2));
207 _GL_EXTERN_C void _gl_unregister_dirp_fd (int fd);
208 # endif
209 # else
210 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd
211
212
213 static inline int (dirfd) (DIR *dp) { return dirfd (dp); }
214 # undef dirfd
215 # endif
216 # if !(@HAVE_DECL_DIRFD@ || defined dirfd)
217 _GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
218 # endif
219 _GL_CXXALIAS_SYS (dirfd, int, (DIR *));
220 # endif
221 _GL_CXXALIASWARN (dirfd);
222 #elif defined GNULIB_POSIXCHECK
223 # undef dirfd
224 # if HAVE_RAW_DECL_DIRFD
225 _GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
226 "use gnulib module dirfd for portability");
227 # endif
228 #endif
229
230 #if @GNULIB_FDOPENDIR@
231
232
233
234
235
236 # if @REPLACE_FDOPENDIR@
237 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
238 # undef fdopendir
239 # define fdopendir rpl_fdopendir
240 # endif
241 _GL_FUNCDECL_RPL (fdopendir, DIR *,
242 (int fd)
243 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
244 _GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd));
245 # else
246 # if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ || __GNUC__ >= 11
247 _GL_FUNCDECL_SYS (fdopendir, DIR *,
248 (int fd)
249 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
250 # endif
251 _GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd));
252 # endif
253 _GL_CXXALIASWARN (fdopendir);
254 #else
255 # if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined fdopendir
256
257
258 _GL_FUNCDECL_SYS (fdopendir, DIR *,
259 (int fd)
260 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
261 # endif
262 # if defined GNULIB_POSIXCHECK
263 # undef fdopendir
264 # if HAVE_RAW_DECL_FDOPENDIR
265 _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
266 "use gnulib module fdopendir for portability");
267 # endif
268 # endif
269 #endif
270
271 #if @GNULIB_SCANDIR@
272
273
274
275
276 # if !@HAVE_SCANDIR@
277 _GL_FUNCDECL_SYS (scandir, int,
278 (const char *dir, struct dirent ***namelist,
279 int (*filter) (const struct dirent *),
280 int (*cmp) (const struct dirent **, const struct dirent **))
281 _GL_ARG_NONNULL ((1, 2, 4)));
282 # endif
283
284
285 _GL_CXXALIAS_SYS_CAST (scandir, int,
286 (const char *dir, struct dirent ***namelist,
287 int (*filter) (const struct dirent *),
288 int (*cmp) (const struct dirent **, const struct dirent **)));
289 _GL_CXXALIASWARN (scandir);
290 #elif defined GNULIB_POSIXCHECK
291 # undef scandir
292 # if HAVE_RAW_DECL_SCANDIR
293 _GL_WARN_ON_USE (scandir, "scandir is unportable - "
294 "use gnulib module scandir for portability");
295 # endif
296 #endif
297
298 #if @GNULIB_ALPHASORT@
299
300 # if !@HAVE_ALPHASORT@
301 _GL_FUNCDECL_SYS (alphasort, int,
302 (const struct dirent **, const struct dirent **)
303 _GL_ATTRIBUTE_PURE
304 _GL_ARG_NONNULL ((1, 2)));
305 # endif
306
307
308 _GL_CXXALIAS_SYS_CAST (alphasort, int,
309 (const struct dirent **, const struct dirent **));
310 _GL_CXXALIASWARN (alphasort);
311 #elif defined GNULIB_POSIXCHECK
312 # undef alphasort
313 # if HAVE_RAW_DECL_ALPHASORT
314 _GL_WARN_ON_USE (alphasort, "alphasort is unportable - "
315 "use gnulib module alphasort for portability");
316 # endif
317 #endif
318
319
320 #endif
321 #endif