home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hsys.z / stat.h < prev    next >
C/C++ Source or Header  |  1996-11-06  |  8KB  |  219 lines

  1. /*
  2.  *  sys/stat.h    Equates and prototype for fstat, stat functions
  3.  *
  4.  *  Copyright by WATCOM International Corp. 1988-1996.  All rights reserved.
  5.  */
  6. #ifndef _STAT_H_INCLUDED
  7. #define _STAT_H_INCLUDED
  8. #if !defined(_ENABLE_AUTODEPEND)
  9.   #pragma read_only_file;
  10. #endif
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14.  
  15. #ifndef _COMDEF_H_INCLUDED
  16.  #include <_comdef.h>
  17. #endif
  18.  
  19. #ifndef _MAX_NAME
  20. #define _MAX_NAME 13    /* maximum length of file name (with extension) */
  21. #endif
  22.  
  23. #ifndef _WCHAR_T_DEFINED
  24. #define _WCHAR_T_DEFINED
  25. #define _WCHAR_T_DEFINED_
  26. #ifdef __cplusplus
  27. typedef long char wchar_t;
  28. #else
  29. typedef unsigned short wchar_t;
  30. #endif
  31. #endif
  32.  
  33. #ifndef __TYPES_H_INCLUDED
  34.  #include <sys/types.h>
  35. #endif
  36.  
  37. #if defined(_M_IX86)
  38.   #pragma pack(__push,1);
  39. #else
  40.   #pragma pack(__push,8);
  41. #endif
  42.  
  43. struct _stat {
  44.     dev_t    st_dev;     /* disk drive file resides on */
  45.     ino_t    st_ino;     /* this inode's #, not used for DOS */
  46.     unsigned short st_mode; /* file mode */
  47.     short    st_nlink;    /* # of hard links */
  48.     unsigned long  st_uid;    /* user-id, always 'root' */
  49.     short    st_gid;     /* group-id, always 'root' */
  50.     dev_t    st_rdev;    /* should be device type */
  51.                 /* but same as st_dev for the time being */
  52.     off_t    st_size;    /* total file size */
  53.     time_t    st_atime;    /* should be file last access time */
  54.     time_t    st_mtime;    /* file last modify time */
  55.     time_t    st_ctime;    /* should be file last status change time */
  56.     time_t            st_btime; /* last archived date and time */
  57.     unsigned long        st_attr;  /* file attributes */
  58.                            /* next 4 fields Netware only */
  59.     unsigned long        st_archivedID; /* user/object ID that last archived file*/
  60.     unsigned long        st_updatedID;  /* user/object ID that last updated file*/
  61.     unsigned short        st_inheritedRightsMask;
  62.     unsigned char        st_originatingNameSpace;
  63.     unsigned char        st_name[_MAX_NAME]; /* ASCIIZ filename */
  64. };
  65.  
  66. struct stat {
  67.     dev_t    st_dev;     /* disk drive file resides on */
  68.     ino_t    st_ino;     /* this inode's #, not used for DOS */
  69.     unsigned short st_mode; /* file mode */
  70.     short    st_nlink;    /* # of hard links */
  71.     unsigned long  st_uid;    /* user-id, always 'root' */
  72.     short    st_gid;     /* group-id, always 'root' */
  73.     dev_t    st_rdev;    /* should be device type */
  74.                 /* but same as st_dev for the time being */
  75.     off_t    st_size;    /* total file size */
  76.     time_t    st_atime;    /* should be file last access time */
  77.     time_t    st_mtime;    /* file last modify time */
  78.     time_t    st_ctime;    /* should be file last status change time */
  79.     time_t            st_btime; /* last archived date and time */
  80.     unsigned long        st_attr;  /* file attributes */
  81.                            /* next 4 fields Netware only */
  82.     unsigned long        st_archivedID; /* user/object ID that last archived file*/
  83.     unsigned long        st_updatedID;  /* user/object ID that last updated file*/
  84.     unsigned short        st_inheritedRightsMask;
  85.     unsigned char        st_originatingNameSpace;
  86.     unsigned char        st_name[_MAX_NAME]; /* ASCIIZ filename */
  87. };
  88.  
  89. struct _wstat {
  90.     dev_t    st_dev;     /* disk drive file resides on */
  91.     ino_t    st_ino;     /* this inode's #, not used for DOS */
  92.     unsigned short st_mode; /* file mode */
  93.     short    st_nlink;    /* # of hard links */
  94.     unsigned long  st_uid;    /* user-id, always 'root' */
  95.     short    st_gid;     /* group-id, always 'root' */
  96.     dev_t    st_rdev;    /* should be device type */
  97.                 /* but same as st_dev for the time being */
  98.     off_t    st_size;    /* total file size */
  99.     time_t    st_atime;    /* should be file last access time */
  100.     time_t    st_mtime;    /* file last modify time */
  101.     time_t    st_ctime;    /* should be file last status change time */
  102.     time_t            st_btime; /* last archived date and time */
  103.     unsigned long        st_attr;  /* file attributes */
  104.                            /* next 4 fields Netware only */
  105.     unsigned long        st_archivedID; /* user/object ID that last archived file*/
  106.     unsigned long        st_updatedID;  /* user/object ID that last updated file*/
  107.     unsigned short        st_inheritedRightsMask;
  108.     unsigned char        st_originatingNameSpace;
  109.     wchar_t            st_name[_MAX_NAME]; /* wide char filename */
  110. };
  111.  
  112. #ifdef __WATCOM_INT64__
  113. struct _stati64 {
  114.     dev_t    st_dev;     /* disk drive file resides on */
  115.     ino_t    st_ino;     /* this inode's #, not used for DOS */
  116.     unsigned short st_mode; /* file mode */
  117.     short    st_nlink;    /* # of hard links */
  118.     unsigned long  st_uid;    /* user-id, always 'root' */
  119.     short    st_gid;     /* group-id, always 'root' */
  120.     dev_t    st_rdev;    /* should be device type */
  121.                 /* but same as st_dev for the time being */
  122.     __int64    st_size;    /* total file size */
  123.     time_t    st_atime;    /* should be file last access time */
  124.     time_t    st_mtime;    /* file last modify time */
  125.     time_t    st_ctime;    /* should be file last status change time */
  126.     time_t            st_btime; /* last archived date and time */
  127.     unsigned long        st_attr;  /* file attributes */
  128.                            /* next 4 fields Netware only */
  129.     unsigned long        st_archivedID; /* user/object ID that last archived file*/
  130.     unsigned long        st_updatedID;  /* user/object ID that last updated file*/
  131.     unsigned short        st_inheritedRightsMask;
  132.     unsigned char        st_originatingNameSpace;
  133.     unsigned char        st_name[_MAX_NAME]; /* ASCIIZ filename */
  134. };
  135.  
  136. struct _wstati64 {
  137.     dev_t    st_dev;     /* disk drive file resides on */
  138.     ino_t    st_ino;     /* this inode's #, not used for DOS */
  139.     unsigned short st_mode; /* file mode */
  140.     short    st_nlink;    /* # of hard links */
  141.     unsigned long  st_uid;    /* user-id, always 'root' */
  142.     short    st_gid;     /* group-id, always 'root' */
  143.     dev_t    st_rdev;    /* should be device type */
  144.                 /* but same as st_dev for the time being */
  145.     __int64    st_size;    /* total file size */
  146.     time_t    st_atime;    /* should be file last access time */
  147.     time_t    st_mtime;    /* file last modify time */
  148.     time_t    st_ctime;    /* should be file last status change time */
  149.     time_t            st_btime; /* last archived date and time */
  150.     unsigned long        st_attr;  /* file attributes */
  151.                            /* next 4 fields Netware only */
  152.     unsigned long        st_archivedID; /* user/object ID that last archived file*/
  153.     unsigned long        st_updatedID;  /* user/object ID that last updated file*/
  154.     unsigned short        st_inheritedRightsMask;
  155.     unsigned char        st_originatingNameSpace;
  156.     wchar_t            st_name[_MAX_NAME]; /* wide char filename */
  157. };
  158. #endif
  159.  
  160. /* File attribute constants for st_mode field */
  161. #define S_IFMT        0170000 /* type of file */
  162. #define S_IFDIR     0040000 /* directory */
  163. #define S_IFCHR     0020000 /* character special file */
  164. #define S_IFFIFO    0010000 /* FIFO */
  165. #define S_IFREG     0100000 /* regular */
  166. /* the following is not possible on PC */
  167. #define S_ISBLK( m )    0
  168. #define S_ISFIFO( m )    (((m) & S_IFMT) == S_IFFIFO)
  169. #define S_ISCHR( m )    (((m) & S_IFMT) == S_IFCHR)
  170. #define S_ISDIR( m )    (((m) & S_IFMT) == S_IFDIR)
  171. #define S_ISREG( m )    (((m) & S_IFMT) == S_IFREG)
  172.  
  173. /* owner permission */
  174. #define S_IRWXU     0000700
  175. #define S_IRUSR     0000400
  176. #define S_IWUSR     0000200
  177. #define S_IXUSR     0000100
  178. #define S_IREAD     0000400
  179. #define S_IWRITE    0000200
  180. #define S_IEXEC     0000100
  181.  
  182. /* group permission.  same as owner's on PC and PenPoint*/
  183. #define S_IRWXG     0000070
  184. #define S_IRGRP     0000040
  185. #define S_IWGRP     0000020
  186. #define S_IXGRP     0000010
  187.  
  188. /* other permission.  same as owner's on PC and PenPoint*/
  189. #define S_IRWXO     0000007
  190. #define S_IROTH     0000004
  191. #define S_IWOTH     0000002
  192. #define S_IXOTH     0000001
  193.  
  194. /* setuid, setgid, and sticky.    always false on PC */
  195. #define S_ISUID     0004000
  196. #define S_ISGID     0002000
  197. #define S_ISVTX     0001000
  198.  
  199. _WCRTLINK extern int fstat( int, struct stat * );
  200. _WCRTLINK extern int _fstat( int, struct _stat * );
  201. _WCRTLINK extern int stat( const char *, struct stat * );
  202. _WCRTLINK extern int _stat( const char *, struct _stat * );
  203.  
  204. _WCRTLINK extern int _wstat( const wchar_t *, struct _wstat * );
  205. _WCRTLINK extern int _wfstat( int, struct _wstat * );
  206.  
  207. #ifdef __WATCOM_INT64__
  208. _WCRTLINK extern int _fstati64( int, struct _stati64 * );
  209. _WCRTLINK extern int _wfstati64( int, struct _wstati64 * );
  210. _WCRTLINK extern int _stati64( const char *, struct _stati64 * );
  211. _WCRTLINK extern int _wstati64( const wchar_t *, struct _wstati64 * );
  212. #endif
  213.  
  214. #pragma pack(__pop);
  215. #ifdef __cplusplus
  216. };
  217. #endif
  218. #endif
  219.