home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 1.ddi / GENSYS.PAK / STAT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  2.5 KB  |  118 lines

  1. /*  stat.h
  2.  
  3.     Definitions used for file status functions
  4. */
  5.  
  6. /* $Copyright: 1987$ */
  7.  
  8. #if !defined(__STAT_H)
  9. #define __STAT_H
  10.  
  11. #if !defined(___DEFS_H)
  12. #include <_defs.h>
  13. #endif
  14.  
  15. #if !defined(__TYPES_H)
  16. #include <sys/types.h>
  17. #endif
  18.  
  19. /* Traditional names for bits in st_mode.
  20.  */
  21. #define S_IFMT  0xF000  /* file type mask */
  22. #define S_IFDIR 0x4000  /* directory */
  23. #define S_IFIFO 0x1000  /* FIFO special */
  24. #define S_IFCHR 0x2000  /* character special */
  25. #define S_IFBLK 0x3000  /* block special */
  26. #define S_IFREG 0x8000  /* or just 0x0000, regular */
  27. #define S_IREAD 0x0100  /* owner may read */
  28. #define S_IWRITE 0x0080 /* owner may write */
  29. #define S_IEXEC 0x0040  /* owner may execute <directory search> */
  30.  
  31. #if defined(__FLAT__)
  32. /* POSIX file type test macros.  The parameter is an st_mode value.
  33.  */
  34. #define S_ISDIR(m)  ((m) & S_IFDIR)
  35. #define S_ISCHR(m)  ((m) & S_IFCHR)
  36. #define S_ISBLK(m)  ((m) & S_IFBLK)
  37. #define S_ISREG(m)  ((m) & S_IFREG)
  38. #define S_ISFIFO(m) ((m) & S_IFIFO)
  39.  
  40. /* POSIX names for bits in st_mode.
  41.  */
  42. #define S_IRWXU  0x01c0 /* RWE permissions mask for owner */
  43. #define S_IRUSR  0x0100 /* owner may read */
  44. #define S_IWUSR  0x0080 /* owner may write */
  45. #define S_IXUSR  0x0040 /* owner may execute <directory search> */
  46.  
  47. #if !defined(_RC_INVOKED)
  48. #pragma pack(1)
  49. #endif
  50.  
  51. struct  stat
  52. {
  53.     dev_t   st_dev;
  54.     ino_t   st_ino;
  55.     mode_t  st_mode;
  56.     nlink_t st_nlink;
  57.     uid_t   st_uid;
  58.     gid_t   st_gid;
  59.     dev_t   st_rdev;
  60.     off_t   st_size;
  61.     time_t  st_atime;
  62.     time_t  st_mtime;
  63.     time_t  st_ctime;
  64. };
  65.  
  66. #if !defined(_RC_INVOKED)
  67. #pragma pack()
  68. #endif
  69.  
  70. #else
  71. struct  stat
  72. {
  73.     short st_dev;
  74.     short st_ino;
  75.     short st_mode;
  76.     short st_nlink;
  77.     int   st_uid;
  78.     int   st_gid;
  79.     short st_rdev;
  80.     long  st_size;
  81.     long  st_atime;
  82.     long  st_mtime;
  83.     long  st_ctime;
  84. };
  85. #endif  /* __FLAT__ */
  86.  
  87. #ifdef __cplusplus
  88. extern "C" {
  89. #endif
  90. int  _RTLENTRY _EXPFUNC fstat(int __handle, struct stat _FAR *__statbuf);
  91. int  _RTLENTRY _EXPFUNC stat(const char _FAR *__path, struct stat _FAR *__statbuf);
  92.  
  93. #ifdef __MSC
  94. #define _fstat(h,b) fstat(h,(struct stat *)b)
  95. #define _stat(p,b)   stat(p,(struct stat *)b)
  96. struct  _stat
  97. {
  98.     short st_dev;
  99.     short st_ino;
  100.     short st_mode;
  101.     short st_nlink;
  102.     int   st_uid;
  103.     int   st_gid;
  104.     short st_rdev;
  105.     long  st_size;
  106.     long  st_atime;
  107.     long  st_mtime;
  108.     long  st_ctime;
  109. };
  110. #endif
  111.  
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115.  
  116. #endif  /* __STAT_H */
  117.  
  118.