summaryrefslogtreecommitdiff
path: root/lib/dirent.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-10-19 12:47:52 +0200
committerBruno Haible <bruno@clisp.org>2008-10-19 12:47:52 +0200
commit2cf6b078ffb5955943be20eec0a1d6742b118c5e (patch)
treec4e0c192f121d65c81c346744d361fa4421e03e1 /lib/dirent.in.h
parentcded3d983ba2d3e0c76bc1c721c78333fa31b385 (diff)
downloadgnulib-2cf6b078ffb5955943be20eec0a1d6742b118c5e.tar.gz
Move the dirfd() declaration to <dirent.h>.
Diffstat (limited to 'lib/dirent.in.h')
-rw-r--r--lib/dirent.in.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index 170a2fda2b..2b1d0a52a2 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -26,13 +26,15 @@
#ifndef _GL_DIRENT_H
#define _GL_DIRENT_H
+/* The definition of GL_LINK_WARNING is copied here. */
-/* Declare overridden functions. */
#ifdef __cplusplus
extern "C" {
#endif
+/* Declare overridden functions. */
+
#if @REPLACE_FCHDIR@
# define opendir rpl_opendir
extern DIR * opendir (const char *);
@@ -40,6 +42,22 @@ extern DIR * opendir (const char *);
extern int closedir (DIR *);
#endif
+/* Declare GNU extensions. */
+
+#if @GNULIB_DIRFD@
+# if !@HAVE_DECL_DIRFD@ && !defined dirfd
+/* Return the file descriptor associated with the given directory stream,
+ or -1 if none exists. */
+extern int dirfd (DIR const *dir);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef dirfd
+# define dirfd(d) \
+ (GL_LINK_WARNING ("dirfd is unportable - " \
+ "use gnulib module dirfd for portability"), \
+ dirfd (d))
+#endif
+
#ifdef __cplusplus
}
#endif