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