2003-05-12 19:06:27 +08:00
|
|
|
/* Posix dirent.h for WIN32.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
/* Including this file should not require any Windows headers. */
|
2005-05-02 11:50:11 +08:00
|
|
|
|
2003-05-12 19:06:27 +08:00
|
|
|
#ifndef _SYS_DIRENT_H
|
|
|
|
#define _SYS_DIRENT_H
|
|
|
|
|
2016-03-15 05:17:38 +08:00
|
|
|
#include <sys/cdefs.h>
|
2003-05-12 19:06:27 +08:00
|
|
|
#include <sys/types.h>
|
2007-12-07 02:24:06 +08:00
|
|
|
#include <limits.h>
|
2003-05-12 19:06:27 +08:00
|
|
|
|
|
|
|
#define __DIRENT_VERSION 2
|
|
|
|
|
2017-11-27 21:36:06 +08:00
|
|
|
#ifdef __i386__
|
2003-05-12 19:06:27 +08:00
|
|
|
#pragma pack(push,4)
|
2013-04-23 17:44:36 +08:00
|
|
|
#endif
|
2008-11-28 17:04:35 +08:00
|
|
|
#define _DIRENT_HAVE_D_TYPE
|
2003-05-12 19:06:27 +08:00
|
|
|
struct dirent
|
|
|
|
{
|
2013-04-23 17:44:36 +08:00
|
|
|
uint32_t __d_version; /* Used internally */
|
|
|
|
ino_t d_ino;
|
2008-11-28 17:04:35 +08:00
|
|
|
unsigned char d_type;
|
|
|
|
unsigned char __d_unused1[3];
|
2006-01-28 05:50:42 +08:00
|
|
|
__uint32_t __d_internal1;
|
2007-12-05 23:10:20 +08:00
|
|
|
char d_name[NAME_MAX + 1];
|
2003-05-12 19:06:27 +08:00
|
|
|
};
|
2017-11-27 21:36:06 +08:00
|
|
|
#ifdef __i386__
|
2003-05-12 19:06:27 +08:00
|
|
|
#pragma pack(pop)
|
2013-04-23 17:44:36 +08:00
|
|
|
#endif
|
2003-05-12 19:06:27 +08:00
|
|
|
|
2010-08-07 02:55:25 +08:00
|
|
|
#define d_fileno d_ino /* BSD compatible definition */
|
|
|
|
|
2013-04-23 17:44:36 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
#define __DIRENT_COOKIE 0xcdcd8484
|
|
|
|
#else
|
2003-05-12 19:06:27 +08:00
|
|
|
#define __DIRENT_COOKIE 0xdede4242
|
2013-04-23 17:44:36 +08:00
|
|
|
#endif
|
2003-05-12 19:06:27 +08:00
|
|
|
|
2017-11-27 21:36:06 +08:00
|
|
|
#ifdef __i386__
|
2003-09-08 12:04:19 +08:00
|
|
|
#pragma pack(push,4)
|
2013-04-23 17:44:36 +08:00
|
|
|
#endif
|
2003-05-12 19:06:27 +08:00
|
|
|
typedef struct __DIR
|
|
|
|
{
|
|
|
|
/* This is first to set alignment in non _COMPILING_NEWLIB case. */
|
|
|
|
unsigned long __d_cookie;
|
|
|
|
struct dirent *__d_dirent;
|
2006-01-21 00:04:40 +08:00
|
|
|
char *__d_dirname; /* directory name with trailing '*' */
|
2013-04-23 17:44:36 +08:00
|
|
|
__int32_t __d_position; /* used by telldir/seekdir */
|
2006-01-21 10:24:17 +08:00
|
|
|
int __d_fd;
|
2013-04-23 17:44:36 +08:00
|
|
|
uintptr_t __d_internal;
|
2003-09-08 12:04:19 +08:00
|
|
|
void *__handle;
|
|
|
|
void *__fh;
|
|
|
|
unsigned __flags;
|
2003-05-12 19:06:27 +08:00
|
|
|
} DIR;
|
2017-11-27 21:36:06 +08:00
|
|
|
#ifdef __i386__
|
2003-09-08 12:04:19 +08:00
|
|
|
#pragma pack(pop)
|
2013-04-23 17:44:36 +08:00
|
|
|
#endif
|
2003-05-12 19:06:27 +08:00
|
|
|
|
2016-03-15 05:17:38 +08:00
|
|
|
#if __BSD_VISIBLE
|
2008-11-28 17:04:35 +08:00
|
|
|
#ifdef _DIRENT_HAVE_D_TYPE
|
2005-08-07 07:00:06 +08:00
|
|
|
/* File types for `d_type'. */
|
|
|
|
enum
|
2005-08-12 10:39:13 +08:00
|
|
|
{
|
|
|
|
DT_UNKNOWN = 0,
|
2005-08-07 07:00:06 +08:00
|
|
|
# define DT_UNKNOWN DT_UNKNOWN
|
2005-08-12 10:39:13 +08:00
|
|
|
DT_FIFO = 1,
|
2005-08-07 07:00:06 +08:00
|
|
|
# define DT_FIFO DT_FIFO
|
2005-08-12 10:39:13 +08:00
|
|
|
DT_CHR = 2,
|
2005-08-07 07:00:06 +08:00
|
|
|
# define DT_CHR DT_CHR
|
2005-08-12 10:39:13 +08:00
|
|
|
DT_DIR = 4,
|
2005-08-07 07:00:06 +08:00
|
|
|
# define DT_DIR DT_DIR
|
2005-08-12 10:39:13 +08:00
|
|
|
DT_BLK = 6,
|
2005-08-07 07:00:06 +08:00
|
|
|
# define DT_BLK DT_BLK
|
2005-08-12 10:39:13 +08:00
|
|
|
DT_REG = 8,
|
2005-08-07 07:00:06 +08:00
|
|
|
# define DT_REG DT_REG
|
2005-08-12 10:39:13 +08:00
|
|
|
DT_LNK = 10,
|
2005-08-07 07:00:06 +08:00
|
|
|
# define DT_LNK DT_LNK
|
2005-08-12 10:39:13 +08:00
|
|
|
DT_SOCK = 12,
|
2005-08-07 07:00:06 +08:00
|
|
|
# define DT_SOCK DT_SOCK
|
2005-08-12 10:39:13 +08:00
|
|
|
DT_WHT = 14
|
2005-08-07 07:00:06 +08:00
|
|
|
# define DT_WHT DT_WHT
|
2005-08-12 10:39:13 +08:00
|
|
|
};
|
2005-08-07 07:00:06 +08:00
|
|
|
|
|
|
|
/* Convert between stat structure types and directory types. */
|
2005-08-12 10:39:13 +08:00
|
|
|
# define IFTODT(mode) (((mode) & 0170000) >> 12)
|
2005-08-07 07:00:06 +08:00
|
|
|
# define DTTOIF(dirtype) ((dirtype) << 12)
|
2008-11-28 17:04:35 +08:00
|
|
|
#endif /* _DIRENT_HAVE_D_TYPE */
|
2016-03-15 05:17:38 +08:00
|
|
|
#endif /* __BSD_VISIBLE */
|
2005-08-12 10:39:13 +08:00
|
|
|
#endif /*_SYS_DIRENT_H*/
|