"Fossies" - the Fresh Open Source Software Archive

Member "usr/include/sys/dirent.h" (19 Aug 2019, 2072 Bytes) of package /windows/misc/cygwin-20190819-x86.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* Posix dirent.h for WIN32.
    2 
    3    This software is a copyrighted work licensed under the terms of the
    4    Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
    5    details. */
    6 
    7 /* Including this file should not require any Windows headers.  */
    8 
    9 #ifndef _SYS_DIRENT_H
   10 #define _SYS_DIRENT_H
   11 
   12 #include <sys/cdefs.h>
   13 #include <sys/types.h>
   14 #include <limits.h>
   15 
   16 #define __DIRENT_VERSION    2
   17 
   18 #ifdef __i386__
   19 #pragma pack(push,4)
   20 #endif
   21 #define _DIRENT_HAVE_D_TYPE
   22 struct dirent
   23 {
   24   uint32_t __d_version;         /* Used internally */
   25   ino_t d_ino;
   26   unsigned char d_type;
   27   unsigned char __d_unused1[3];
   28   __uint32_t __d_internal1;
   29   char d_name[NAME_MAX + 1];
   30 };
   31 #ifdef __i386__
   32 #pragma pack(pop)
   33 #endif
   34 
   35 #define d_fileno d_ino          /* BSD compatible definition */
   36 
   37 #ifdef __x86_64__
   38 #define __DIRENT_COOKIE 0xcdcd8484
   39 #else
   40 #define __DIRENT_COOKIE 0xdede4242
   41 #endif
   42 
   43 #ifdef __i386__
   44 #pragma pack(push,4)
   45 #endif
   46 typedef struct __DIR
   47 {
   48   /* This is first to set alignment in non _COMPILING_NEWLIB case.  */
   49   unsigned long __d_cookie;
   50   struct dirent *__d_dirent;
   51   char *__d_dirname;            /* directory name with trailing '*' */
   52   __int32_t __d_position;           /* used by telldir/seekdir */
   53   int __d_fd;
   54   uintptr_t __d_internal;
   55   void *__handle;
   56   void *__fh;
   57   unsigned __flags;
   58 } DIR;
   59 #ifdef __i386__
   60 #pragma pack(pop)
   61 #endif
   62 
   63 #if __BSD_VISIBLE
   64 #ifdef _DIRENT_HAVE_D_TYPE
   65 /* File types for `d_type'.  */
   66 enum
   67 {
   68   DT_UNKNOWN = 0,
   69 # define DT_UNKNOWN     DT_UNKNOWN
   70   DT_FIFO = 1,
   71 # define DT_FIFO        DT_FIFO
   72   DT_CHR = 2,
   73 # define DT_CHR         DT_CHR
   74   DT_DIR = 4,
   75 # define DT_DIR         DT_DIR
   76   DT_BLK = 6,
   77 # define DT_BLK         DT_BLK
   78   DT_REG = 8,
   79 # define DT_REG         DT_REG
   80   DT_LNK = 10,
   81 # define DT_LNK         DT_LNK
   82   DT_SOCK = 12,
   83 # define DT_SOCK        DT_SOCK
   84   DT_WHT = 14
   85 # define DT_WHT         DT_WHT
   86 };
   87 
   88 /* Convert between stat structure types and directory types.  */
   89 # define IFTODT(mode)       (((mode) & 0170000) >> 12)
   90 # define DTTOIF(dirtype)        ((dirtype) << 12)
   91 #endif /* _DIRENT_HAVE_D_TYPE */
   92 #endif /* __BSD_VISIBLE */
   93 #endif /*_SYS_DIRENT_H*/