summaryrefslogtreecommitdiffstats
path: root/include/c.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/c.h')
-rw-r--r--include/c.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/c.h b/include/c.h
index 83be3565c..b37c44224 100644
--- a/include/c.h
+++ b/include/c.h
@@ -73,5 +73,14 @@ static inline __attribute__((const)) int is_power_of_2(unsigned long num)
typedef int64_t loff_t;
#endif
+#if !defined(HAVE_DIRFD) && (!defined(HAVE_DECL_DIRFD) || HAVE_DECL_DIRFD == 0) && defined(HAVE_DIR_DD_FD)
+#include <sys/types.h>
+#include <dirent.h>
+static inline int dirfd(DIR *d)
+{
+ return d->dd_fd;
+}
+#endif
+
#endif /* UTIL_LINUX_C_H */