fix handling of d_name in struct dirent
[musl] / include / dirent.h
index a917093..7b70abd 100644 (file)
@@ -18,9 +18,11 @@ struct dirent
        off_t d_off;
        unsigned short d_reclen;
        unsigned char d_type;
-       char d_name[1];
+       char d_name[256];
 };
 
+#define d_fileno d_ino
+
 int            closedir(DIR *);
 DIR           *fdopendir(int);
 DIR           *opendir(const char *);
@@ -34,8 +36,22 @@ int            dirfd(DIR *);
 int alphasort(const struct dirent **, const struct dirent **);
 int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
 
+#ifdef _GNU_SOURCE
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
+#define IFTODT(x) ((x)>>12 & 017)
+#define DTTOIF(x) ((x)<<12)
+#endif
+
 #ifdef __cplusplus
-extern }
+}
 #endif
 
 #endif