summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/include
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-11-28 09:04:35 +0000
committerCorinna Vinschen <corinna@vinschen.de>2008-11-28 09:04:35 +0000
commitfa421c7a751ebde2acc62dcf032fb3b36f698db1 (patch)
tree0a4bb4359e801b30dc098767e5a70ab9b9528546 /winsup/cygwin/include
parent65ebf94e53514dc266c74bea7908ad3fe7fc4ebc (diff)
downloadcygnal-fa421c7a751ebde2acc62dcf032fb3b36f698db1.tar.gz
cygnal-fa421c7a751ebde2acc62dcf032fb3b36f698db1.tar.bz2
cygnal-fa421c7a751ebde2acc62dcf032fb3b36f698db1.zip
* dir.cc (readdir_worker): Initialize dirent.d_type and __d_unused1.
* fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Set dirent.d_type based on FILE_ATTRIBUTE_*. * include/sys/dirent.h: Define _DIRENT_HAVE_D_TYPE (enables DT_* declarations). (struct dirent): Add d_type. Adjust __d_unused1 size to preserve layout.
Diffstat (limited to 'winsup/cygwin/include')
-rw-r--r--winsup/cygwin/include/sys/dirent.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/winsup/cygwin/include/sys/dirent.h b/winsup/cygwin/include/sys/dirent.h
index 41bfcc11d..451c802bc 100644
--- a/winsup/cygwin/include/sys/dirent.h
+++ b/winsup/cygwin/include/sys/dirent.h
@@ -18,11 +18,13 @@
#pragma pack(push,4)
#if defined(__INSIDE_CYGWIN__) || defined (__CYGWIN_USE_BIG_TYPES__)
+#define _DIRENT_HAVE_D_TYPE
struct dirent
{
long __d_version; /* Used internally */
__ino64_t d_ino;
- __uint32_t __d_unused1;
+ unsigned char d_type;
+ unsigned char __d_unused1[3];
__uint32_t __d_internal1;
char d_name[NAME_MAX + 1];
};
@@ -77,7 +79,7 @@ int scandir (const char *__dir,
int (*compar) (const struct dirent **, const struct dirent **));
int alphasort (const struct dirent **__a, const struct dirent **__b);
-#if 0 /* these make no sense in the absence of d_type */
+#ifdef _DIRENT_HAVE_D_TYPE
/* File types for `d_type'. */
enum
{
@@ -104,6 +106,6 @@ enum
/* Convert between stat structure types and directory types. */
# define IFTODT(mode) (((mode) & 0170000) >> 12)
# define DTTOIF(dirtype) ((dirtype) << 12)
-#endif /* #if 0 */
+#endif /* _DIRENT_HAVE_D_TYPE */
#endif /* _POSIX_SOURCE */
#endif /*_SYS_DIRENT_H*/