home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c495 / watcm951.arj / H_SYS.WPK / STAT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-16  |  2.1 KB  |  79 lines

  1. /*
  2.  *  sys/stat.h    Equates and prototype for fstat, stat functions
  3.  *
  4.  *  Copyright by WATCOM International Corp. 1988-1993.  All rights reserved.
  5.  */
  6. #ifndef _STAT_H_INCLUDED
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10.  
  11.  
  12. #ifndef __TYPES_H_INCLUDED
  13.  #include <sys/types.h>
  14. #endif
  15.  
  16. #pragma pack(1);
  17.  
  18. struct stat {
  19.     dev_t    st_dev;     /* disk drive file resides on */
  20.     ino_t    st_ino;     /* this inode's #, not used for DOS */
  21.     unsigned short st_mode; /* file mode */
  22.     short    st_nlink;    /* # of hard links */
  23.     short    st_uid;     /* user-id, always 'root' */
  24.     short    st_gid;     /* group-id, always 'root' */
  25.     dev_t    st_rdev;    /* should be device type */
  26.                 /* but same as st_dev for the time being */
  27.     off_t    st_size;    /* total file size */
  28.     time_t    st_atime;    /* should be file last access time */
  29.     time_t    st_mtime;    /* file last modify time */
  30.     time_t    st_ctime;    /* should be file last status change time */
  31. };
  32.  
  33. #define S_IFMT        0170000 /* type of file */
  34. #define S_IFDIR     0040000 /* directory */
  35. #define S_IFCHR     0020000 /* character special file */
  36. #define S_IFREG     0100000 /* regular */
  37. /* the following two are not possible on PC */
  38. #define S_ISBLK( m )    0
  39. #define S_ISFIFO( m )    0
  40. #define S_ISCHR( m )    (((m) & S_IFMT) == S_IFCHR)
  41. #define S_ISDIR( m )    (((m) & S_IFMT) == S_IFDIR)
  42. #define S_ISREG( m )    (((m) & S_IFMT) == S_IFREG)
  43.  
  44. /* owner permission */
  45. #define S_IRWXU     0000700
  46. #define S_IRUSR     0000400
  47. #define S_IWUSR     0000200
  48. #define S_IXUSR     0000100
  49. #define S_IREAD     0000400
  50. #define S_IWRITE    0000200
  51. #define S_IEXEC     0000100
  52.  
  53. /* group permission.  same as owner's on PC and PenPoint*/
  54. #define S_IRWXG     0000070
  55. #define S_IRGRP     0000040
  56. #define S_IWGRP     0000020
  57. #define S_IXGRP     0000010
  58.  
  59. /* other permission.  same as owner's on PC and PenPoint*/
  60. #define S_IRWXO     0000007
  61. #define S_IROTH     0000004
  62. #define S_IWOTH     0000002
  63. #define S_IXOTH     0000001
  64.  
  65. /* setuid, setgid, and sticky.    always false on PC */
  66. #define S_ISUID     0004000
  67. #define S_ISGID     0002000
  68. #define S_ISVTX     0001000
  69.  
  70. int fstat( int, struct stat * );
  71. int stat( const char *, struct stat * );
  72.  
  73. #pragma pack();
  74. #define _STAT_H_INCLUDED
  75. #ifdef __cplusplus
  76. };
  77. #endif
  78. #endif
  79.