2003-05-12 13:06:27 +02:00
|
|
|
/* Posix dirent.h for WIN32.
|
|
|
|
|
2006-01-27 22:50:42 +01:00
|
|
|
Copyright 2001, 2002, 2003, 2005, 2006 Red Hat, Inc.
|
2003-05-12 13:06:27 +02:00
|
|
|
|
|
|
|
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 05:50:11 +02:00
|
|
|
|
2003-05-12 13:06:27 +02:00
|
|
|
#ifndef _SYS_DIRENT_H
|
|
|
|
#define _SYS_DIRENT_H
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#define __DIRENT_VERSION 2
|
|
|
|
|
|
|
|
#pragma pack(push,4)
|
2006-01-21 03:24:17 +01:00
|
|
|
#if defined(__INSIDE_CYGWIN__) || defined (__CYGWIN_USE_BIG_TYPES__)
|
2003-05-12 13:06:27 +02:00
|
|
|
struct dirent
|
|
|
|
{
|
2006-01-21 03:24:17 +01:00
|
|
|
long __d_version; /* Used internally */
|
2006-01-27 22:50:42 +01:00
|
|
|
__ino64_t d_ino;
|
2006-01-28 11:34:11 +01:00
|
|
|
__uint32_t __d_unused1;
|
2006-01-27 22:50:42 +01:00
|
|
|
__uint32_t __d_internal1;
|
2006-01-20 17:04:40 +01:00
|
|
|
char d_name[256]; /* FIXME: use NAME_MAX? */
|
2003-05-12 13:06:27 +02:00
|
|
|
};
|
|
|
|
#else
|
|
|
|
struct dirent
|
|
|
|
{
|
|
|
|
long d_version;
|
|
|
|
long d_reserved[2];
|
|
|
|
long d_fd;
|
2006-01-27 22:50:42 +01:00
|
|
|
ino_t d_ino;
|
2003-05-12 13:06:27 +02:00
|
|
|
char d_name[256];
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
#define __DIRENT_COOKIE 0xdede4242
|
|
|
|
|
2003-09-08 06:04:19 +02:00
|
|
|
#pragma pack(push,4)
|
2003-05-12 13:06:27 +02: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-20 17:04:40 +01:00
|
|
|
char *__d_dirname; /* directory name with trailing '*' */
|
|
|
|
_off_t __d_position; /* used by telldir/seekdir */
|
2006-01-21 03:24:17 +01:00
|
|
|
int __d_fd;
|
2006-03-01 14:47:49 +01:00
|
|
|
unsigned __d_internal;
|
2003-09-08 06:04:19 +02:00
|
|
|
void *__handle;
|
|
|
|
void *__fh;
|
|
|
|
unsigned __flags;
|
2003-05-12 13:06:27 +02:00
|
|
|
} DIR;
|
2003-09-08 06:04:19 +02:00
|
|
|
#pragma pack(pop)
|
2003-05-12 13:06:27 +02:00
|
|
|
|
|
|
|
DIR *opendir (const char *);
|
|
|
|
struct dirent *readdir (DIR *);
|
2005-08-20 08:19:55 +02:00
|
|
|
int readdir_r (DIR *, struct dirent *, struct dirent **);
|
2003-05-12 13:06:27 +02:00
|
|
|
void rewinddir (DIR *);
|
|
|
|
int closedir (DIR *);
|
|
|
|
|
|
|
|
int dirfd (DIR *);
|
|
|
|
|
|
|
|
#ifndef _POSIX_SOURCE
|
|
|
|
#ifndef __INSIDE_CYGWIN__
|
|
|
|
off_t telldir (DIR *);
|
|
|
|
void seekdir (DIR *, off_t loc);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int scandir (const char *__dir,
|
|
|
|
struct dirent ***__namelist,
|
|
|
|
int (*select) (const struct dirent *),
|
|
|
|
int (*compar) (const struct dirent **, const struct dirent **));
|
|
|
|
|
|
|
|
int alphasort (const struct dirent **__a, const struct dirent **__b);
|
2006-01-19 06:34:39 +01:00
|
|
|
#if 0 /* these make no sense in the absence of d_type */
|
2005-08-07 01:00:06 +02:00
|
|
|
/* File types for `d_type'. */
|
|
|
|
enum
|
2005-08-12 04:39:13 +02:00
|
|
|
{
|
|
|
|
DT_UNKNOWN = 0,
|
2005-08-07 01:00:06 +02:00
|
|
|
# define DT_UNKNOWN DT_UNKNOWN
|
2005-08-12 04:39:13 +02:00
|
|
|
DT_FIFO = 1,
|
2005-08-07 01:00:06 +02:00
|
|
|
# define DT_FIFO DT_FIFO
|
2005-08-12 04:39:13 +02:00
|
|
|
DT_CHR = 2,
|
2005-08-07 01:00:06 +02:00
|
|
|
# define DT_CHR DT_CHR
|
2005-08-12 04:39:13 +02:00
|
|
|
DT_DIR = 4,
|
2005-08-07 01:00:06 +02:00
|
|
|
# define DT_DIR DT_DIR
|
2005-08-12 04:39:13 +02:00
|
|
|
DT_BLK = 6,
|
2005-08-07 01:00:06 +02:00
|
|
|
# define DT_BLK DT_BLK
|
2005-08-12 04:39:13 +02:00
|
|
|
DT_REG = 8,
|
2005-08-07 01:00:06 +02:00
|
|
|
# define DT_REG DT_REG
|
2005-08-12 04:39:13 +02:00
|
|
|
DT_LNK = 10,
|
2005-08-07 01:00:06 +02:00
|
|
|
# define DT_LNK DT_LNK
|
2005-08-12 04:39:13 +02:00
|
|
|
DT_SOCK = 12,
|
2005-08-07 01:00:06 +02:00
|
|
|
# define DT_SOCK DT_SOCK
|
2005-08-12 04:39:13 +02:00
|
|
|
DT_WHT = 14
|
2005-08-07 01:00:06 +02:00
|
|
|
# define DT_WHT DT_WHT
|
2005-08-12 04:39:13 +02:00
|
|
|
};
|
2005-08-07 01:00:06 +02:00
|
|
|
|
|
|
|
/* Convert between stat structure types and directory types. */
|
2005-08-12 04:39:13 +02:00
|
|
|
# define IFTODT(mode) (((mode) & 0170000) >> 12)
|
2005-08-07 01:00:06 +02:00
|
|
|
# define DTTOIF(dirtype) ((dirtype) << 12)
|
2006-01-20 17:04:40 +01:00
|
|
|
#endif /* #if 0 */
|
2003-05-12 13:06:27 +02:00
|
|
|
#endif /* _POSIX_SOURCE */
|
2005-08-12 04:39:13 +02:00
|
|
|
#endif /*_SYS_DIRENT_H*/
|