home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 June / Chip_2002-06_cd1.bin / zkuste / cecko / install / devcpp4920.exe / include / sys / stat.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-17  |  4.9 KB  |  191 lines

  1. /*
  2.  * stat.h
  3.  *
  4.  * Symbolic constants for opening and creating files, also stat, fstat and
  5.  * chmod functions.
  6.  *
  7.  * This file is part of the Mingw32 package.
  8.  *
  9.  * Contributors:
  10.  *  Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
  11.  *
  12.  *  THIS SOFTWARE IS NOT COPYRIGHTED
  13.  *
  14.  *  This source code is offered for use in the public domain. You may
  15.  *  use, modify or distribute it freely.
  16.  *
  17.  *  This code is distributed in the hope that it will be useful but
  18.  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
  19.  *  DISCLAMED. This includes but is not limited to warranties of
  20.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  21.  *
  22.  * $Revision: 1.5 $
  23.  * $Author: cgf $
  24.  * $Date: 2000/02/05 04:05:01 $
  25.  *
  26.  */
  27.  
  28. #ifndef __STRICT_ANSI__
  29.  
  30. #ifndef _STAT_H_
  31. #define _STAT_H_
  32.  
  33. /* All the headers include this file. */
  34. #include <_mingw.h>
  35.  
  36. #define __need_size_t
  37. #define __need_wchar_t
  38. #ifndef RC_INVOKED
  39. #include <stddef.h>
  40. #endif /* Not RC_INVOKED */
  41.  
  42. #include <sys/types.h>
  43.  
  44. /*
  45.  * Constants for the stat st_mode member.
  46.  */
  47. #define    _S_IFIFO    0x1000    /* FIFO */
  48. #define    _S_IFCHR    0x2000    /* Character */
  49. #define    _S_IFBLK    0x3000    /* Block */
  50. #define    _S_IFDIR    0x4000    /* Directory */
  51. #define    _S_IFREG    0x8000    /* Regular */
  52.  
  53. #define    _S_IFMT        0xF000    /* File type mask */
  54.  
  55. #define    _S_IEXEC    0x0040
  56. #define    _S_IWRITE    0x0080
  57. #define    _S_IREAD    0x0100
  58.  
  59. #define    _S_IRWXU    (_S_IREAD | _S_IWRITE | _S_IEXEC)
  60. #define    _S_IXUSR    _S_IEXEC
  61. #define    _S_IWUSR    _S_IWRITE
  62. #define    _S_IRUSR    _S_IREAD
  63.  
  64. #define    _S_ISDIR(m)    ((m) & _S_IFDIR)
  65. #define    _S_ISFIFO(m)    ((m) & _S_IFIFO)
  66. #define    _S_ISCHR(m)    ((m) & _S_IFCHR)
  67. #define    _S_ISBLK(m)    ((m) & _S_IFBLK)
  68. #define    _S_ISREG(m)    ((m) & _S_IFREG)
  69.  
  70. #ifndef _NO_OLDNAMES
  71.  
  72. #define    S_IFIFO        _S_IFIFO
  73. #define    S_IFCHR        _S_IFCHR
  74. #define    S_IFBLK        _S_IFBLK
  75. #define    S_IFDIR        _S_IFDIR
  76. #define    S_IFREG        _S_IFREG
  77. #define    S_IFMT        _S_IFMT
  78. #define    S_IEXEC        _S_IEXEC
  79. #define    S_IWRITE    _S_IWRITE
  80. #define    S_IREAD        _S_IREAD
  81. #define    S_IRWXU        _S_IRWXU
  82. #define    S_IXUSR        _S_IXUSR
  83. #define    S_IWUSR        _S_IWUSR
  84. #define    S_IRUSR        _S_IRUSR
  85.  
  86. #define    S_ISDIR(m)    ((m) & S_IFDIR)
  87. #define    S_ISFIFO(m)    ((m) & S_IFIFO)
  88. #define    S_ISCHR(m)    ((m) & S_IFCHR)
  89. #define    S_ISBLK(m)    ((m) & S_IFBLK)
  90. #define    S_ISREG(m)    ((m) & S_IFREG)
  91.  
  92. #endif    /* Not _NO_OLDNAMES */
  93.  
  94. #ifndef RC_INVOKED
  95.  
  96. #ifndef _STAT_DEFINED
  97. /*
  98.  * The structure manipulated and returned by stat and fstat.
  99.  *
  100.  * NOTE: If called on a directory the values in the time fields are not only
  101.  * invalid, they will cause localtime et. al. to return NULL. And calling
  102.  * asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
  103.  */
  104. struct _stat
  105. {
  106.     _dev_t    st_dev;        /* Equivalent to drive number 0=A 1=B ... */
  107.     _ino_t    st_ino;        /* Always zero ? */
  108.     _mode_t    st_mode;    /* See above constants */
  109.     short    st_nlink;    /* Number of links. */
  110.     short    st_uid;        /* User: Maybe significant on NT ? */
  111.     short    st_gid;        /* Group: Ditto */
  112.     _dev_t    st_rdev;    /* Seems useless (not even filled in) */
  113.     _off_t    st_size;    /* File size in bytes */
  114.     time_t    st_atime;    /* Accessed date (always 00:00 hrs local
  115.                  * on FAT) */
  116.     time_t    st_mtime;    /* Modified time */
  117.     time_t    st_ctime;    /* Creation time */
  118. };
  119.  
  120. struct stat
  121. {
  122.     _dev_t    st_dev;        /* Equivalent to drive number 0=A 1=B ... */
  123.     _ino_t    st_ino;        /* Always zero ? */
  124.     _mode_t    st_mode;    /* See above constants */
  125.     short    st_nlink;    /* Number of links. */
  126.     short    st_uid;        /* User: Maybe significant on NT ? */
  127.     short    st_gid;        /* Group: Ditto */
  128.     _dev_t    st_rdev;    /* Seems useless (not even filled in) */
  129.     _off_t    st_size;    /* File size in bytes */
  130.     time_t    st_atime;    /* Accessed date (always 00:00 hrs local
  131.                  * on FAT) */
  132.     time_t    st_mtime;    /* Modified time */
  133.     time_t    st_ctime;    /* Creation time */
  134. };
  135. #if defined (__MSVCRT__)
  136. struct _stati64 {
  137.     _dev_t st_dev;
  138.     _ino_t st_ino;
  139.     unsigned short st_mode;
  140.     short st_nlink;
  141.     short st_uid;
  142.     short st_gid;
  143.     _dev_t st_rdev;
  144.     __int64 st_size;
  145.     time_t st_atime;
  146.     time_t st_mtime;
  147.     time_t st_ctime;
  148. };
  149. #endif /* __MSVCRT__ */
  150. #define _STAT_DEFINED
  151. #endif /* _STAT_DEFINED */
  152.  
  153. #ifdef    __cplusplus
  154. extern "C" {
  155. #endif
  156.  
  157. int    _fstat (int, struct _stat*);
  158. int    _chmod (const char*, int);
  159. int    _stat (const char*, struct _stat*);
  160.  
  161. #if defined (__MSVCRT__)
  162. int  _fstati64(int, struct _stati64 *);
  163. int  _stati64(const char *, struct _stati64 *);
  164. #if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */
  165. int    _wstat(const wchar_t*, struct _stat*);
  166. int    _wstati64 (const wchar_t*, struct _stati64*);
  167. #define _WSTAT_DEFINED
  168. #endif /* _WSTAT_DEFIND */
  169. #endif /* __MSVCRT__ */
  170.  
  171. #ifndef    _NO_OLDNAMES
  172.  
  173. /* These functions live in liboldnames.a. */
  174. int    fstat (int, struct stat*);
  175. int    chmod (const char*, int);
  176. int    stat (const char*, struct stat*);
  177.  
  178. #endif    /* Not _NO_OLDNAMES */
  179.  
  180.  
  181. #ifdef    __cplusplus
  182. }
  183. #endif
  184.  
  185. #endif    /* Not RC_INVOKED */
  186.  
  187. #endif    /* Not _STAT_H_ */
  188.  
  189. #endif    /* Not __STRICT_ANSI__ */
  190.  
  191.