Embed:
(wiki syntax)
Show/hide line numbers
stat.h
00001 /* 00002 * stat.h 00003 * This file has no copyright assigned and is placed in the Public Domain. 00004 * This file is a part of the mingw-runtime package. 00005 * No warranty is given; refer to the file DISCLAIMER within the package. 00006 * 00007 * Symbolic constants for opening and creating files, also stat, fstat and 00008 * chmod functions. 00009 * 00010 */ 00011 00012 #ifndef _STAT_H_ 00013 #define _STAT_H_ 00014 00015 /* All the headers include this file. */ 00016 #include <_mingw.h> 00017 00018 #define __need_size_t 00019 #define __need_wchar_t 00020 #ifndef RC_INVOKED 00021 #include <stddef.h> 00022 #endif /* Not RC_INVOKED */ 00023 00024 #include <sys/types.h> 00025 00026 /* 00027 * Constants for the stat st_mode member. 00028 */ 00029 #define _S_IFIFO 0x1000 /* FIFO */ 00030 #define _S_IFCHR 0x2000 /* Character */ 00031 #define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */ 00032 #define _S_IFDIR 0x4000 /* Directory */ 00033 #define _S_IFREG 0x8000 /* Regular */ 00034 00035 #define _S_IFMT 0xF000 /* File type mask */ 00036 00037 #define _S_IEXEC 0x0040 00038 #define _S_IWRITE 0x0080 00039 #define _S_IREAD 0x0100 00040 00041 #define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) 00042 #define _S_IXUSR _S_IEXEC 00043 #define _S_IWUSR _S_IWRITE 00044 #define _S_IRUSR _S_IREAD 00045 00046 #define _S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) 00047 #define _S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO) 00048 #define _S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR) 00049 #define _S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK) 00050 #define _S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) 00051 00052 #ifndef _NO_OLDNAMES 00053 00054 #define S_IFIFO _S_IFIFO 00055 #define S_IFCHR _S_IFCHR 00056 #define S_IFBLK _S_IFBLK 00057 #define S_IFDIR _S_IFDIR 00058 #define S_IFREG _S_IFREG 00059 #define S_IFMT _S_IFMT 00060 #define S_IEXEC _S_IEXEC 00061 #define S_IWRITE _S_IWRITE 00062 #define S_IREAD _S_IREAD 00063 #define S_IRWXU _S_IRWXU 00064 #define S_IXUSR _S_IXUSR 00065 #define S_IWUSR _S_IWUSR 00066 #define S_IRUSR _S_IRUSR 00067 00068 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 00069 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 00070 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) 00071 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) 00072 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 00073 00074 #endif /* Not _NO_OLDNAMES */ 00075 00076 #ifndef RC_INVOKED 00077 00078 #ifndef _STAT_DEFINED 00079 /* 00080 * The structure manipulated and returned by stat and fstat. 00081 * 00082 * NOTE: If called on a directory the values in the time fields are not only 00083 * invalid, they will cause localtime et. al. to return NULL. And calling 00084 * asctime with a NULL pointer causes an Invalid Page Fault. So watch it! 00085 */ 00086 struct _stat 00087 { 00088 _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ 00089 _ino_t st_ino; /* Always zero ? */ 00090 _mode_t st_mode; /* See above constants */ 00091 short st_nlink; /* Number of links. */ 00092 short st_uid; /* User: Maybe significant on NT ? */ 00093 short st_gid; /* Group: Ditto */ 00094 _dev_t st_rdev; /* Seems useless (not even filled in) */ 00095 _off_t st_size; /* File size in bytes */ 00096 time_t st_atime; /* Accessed date (always 00:00 hrs local 00097 * on FAT) */ 00098 time_t st_mtime; /* Modified time */ 00099 time_t st_ctime; /* Creation time */ 00100 }; 00101 00102 #ifndef _NO_OLDNAMES 00103 /* NOTE: Must be the same as _stat above. */ 00104 struct stat 00105 { 00106 dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ 00107 ino_t st_ino; /* Always zero ? */ 00108 mode_t st_mode; /* See above constants */ 00109 short st_nlink; /* Number of links. */ 00110 short st_uid; /* User: Maybe significant on NT ? */ 00111 short st_gid; /* Group: Ditto */ 00112 dev_t st_rdev; /* Seems useless (not even filled in) */ 00113 off_t st_size; /* File size in bytes */ 00114 time_t st_atime; /* Accessed date (always 00:00 hrs local 00115 * on FAT) */ 00116 time_t st_mtime; /* Modified time */ 00117 time_t st_ctime; /* Creation time */ 00118 }; 00119 #endif /* _NO_OLDNAMES */ 00120 00121 #if defined (__MSVCRT__) 00122 struct _stati64 { 00123 _dev_t st_dev; 00124 _ino_t st_ino; 00125 _mode_t st_mode; 00126 short st_nlink; 00127 short st_uid; 00128 short st_gid; 00129 _dev_t st_rdev; 00130 __int64 st_size; 00131 time_t st_atime; 00132 time_t st_mtime; 00133 time_t st_ctime; 00134 }; 00135 #if __MSVCRT_VERSION__ >= 0x0601 00136 struct __stat64 00137 { 00138 _dev_t st_dev; 00139 _ino_t st_ino; 00140 _mode_t st_mode; 00141 short st_nlink; 00142 short st_uid; 00143 short st_gid; 00144 _dev_t st_rdev; 00145 __int64 st_size; 00146 __time64_t st_atime; 00147 __time64_t st_mtime; 00148 __time64_t st_ctime; 00149 }; 00150 #endif /* __MSVCRT_VERSION__ >= 0x0601 */ 00151 #if __MSVCRT_VERSION__ >= 0x0800 00152 struct __stat32 00153 { 00154 _dev_t st_dev; 00155 _ino_t st_ino; 00156 _mode_t st_mode; 00157 short st_nlink; 00158 short st_uid; 00159 short st_gid; 00160 _dev_t st_rdev; 00161 __int32 st_size; 00162 __time32_t st_atime; 00163 __time32_t st_mtime; 00164 __time32_t st_ctime; 00165 }; 00166 struct _stat32i64 { 00167 _dev_t st_dev; 00168 _ino_t st_ino; 00169 _mode_t st_mode; 00170 short st_nlink; 00171 short st_uid; 00172 short st_gid; 00173 _dev_t st_rdev; 00174 __int64 st_size; 00175 __time32_t st_atime; 00176 __time32_t st_mtime; 00177 __time32_t st_ctime; 00178 }; 00179 struct _stat64i32 { 00180 _dev_t st_dev; 00181 _ino_t st_ino; 00182 _mode_t st_mode; 00183 short st_nlink; 00184 short st_uid; 00185 short st_gid; 00186 _dev_t st_rdev; 00187 __int32 st_size; 00188 __time64_t st_atime; 00189 __time64_t st_mtime; 00190 __time64_t st_ctime; 00191 }; 00192 #endif /* __MSVCRT_VERSION__ >= 0x0800 */ 00193 #endif /* __MSVCRT__ */ 00194 #define _STAT_DEFINED 00195 #endif /* _STAT_DEFINED */ 00196 00197 #ifdef __cplusplus 00198 extern "C" { 00199 #endif 00200 00201 #if __MSVCRT_VERSION__ < 0x0800 00202 _CRTIMP int __cdecl __MINGW_NOTHROW _fstat (int, struct _stat*); 00203 #endif 00204 _CRTIMP int __cdecl __MINGW_NOTHROW _chmod (const char*, int); 00205 #if __MSVCRT_VERSION__ < 0x0800 00206 _CRTIMP int __cdecl __MINGW_NOTHROW _stat (const char*, struct _stat*); 00207 #endif 00208 00209 #ifndef _NO_OLDNAMES 00210 /* FIXME for __MSVCRT_VERSION__ >= 0x0800 */ 00211 /* These functions live in liboldnames.a. */ 00212 _CRTIMP int __cdecl __MINGW_NOTHROW fstat (int, struct stat*); 00213 _CRTIMP int __cdecl __MINGW_NOTHROW chmod (const char*, int); 00214 _CRTIMP int __cdecl __MINGW_NOTHROW stat (const char*, struct stat*); 00215 00216 #endif /* Not _NO_OLDNAMES */ 00217 00218 #if defined (__MSVCRT__) 00219 #if __MSVCRT_VERSION__ < 0x0800 00220 _CRTIMP int __cdecl __MINGW_NOTHROW _fstati64(int, struct _stati64 *); 00221 _CRTIMP int __cdecl __MINGW_NOTHROW _stati64(const char *, struct _stati64 *); 00222 #endif 00223 /* These require newer versions of msvcrt.dll (6.10 or higher). */ 00224 #if __MSVCRT_VERSION__ >= 0x0601 00225 _CRTIMP int __cdecl __MINGW_NOTHROW _fstat64 (int, struct __stat64*); 00226 _CRTIMP int __cdecl __MINGW_NOTHROW _stat64 (const char*, struct __stat64*); 00227 #endif /* __MSVCRT_VERSION__ >= 0x0601 */ 00228 #if __MSVCRT_VERSION__ >= 0x0800 00229 _CRTIMP int __cdecl __MINGW_NOTHROW _fstat32 (int, struct __stat32*); 00230 _CRTIMP int __cdecl __MINGW_NOTHROW _stat32 (const char*, struct __stat32*); 00231 _CRTIMP int __cdecl __MINGW_NOTHROW _fstat32i64 (int, struct _stat32i64*); 00232 _CRTIMP int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*); 00233 _CRTIMP int __cdecl __MINGW_NOTHROW _stat32i64 (const char*, struct _stat32i64*); 00234 _CRTIMP int __cdecl __MINGW_NOTHROW _stat64i32 (const char*, struct _stat64i32*); 00235 #ifndef _USE_32BIT_TIME_T 00236 _CRTALIAS int __cdecl __MINGW_NOTHROW _fstat (int _v1, struct _stat* _v2) { return(_fstat64i32 (_v1,(struct _stat64i32*)_v2)); } 00237 _CRTALIAS int __cdecl __MINGW_NOTHROW _stat (const char* _v1, struct _stat* _v2) { return(_stat64i32 (_v1,(struct _stat64i32*)_v2)); } 00238 _CRTALIAS int __cdecl __MINGW_NOTHROW _fstati64 (int _v1, struct _stati64* _v2) { return(_fstat64 (_v1,(struct __stat64*)_v2)); } 00239 _CRTALIAS int __cdecl __MINGW_NOTHROW _stati64 (const char* _v1, struct _stati64* _v2) { return(_stat64 (_v1,(struct __stat64*)_v2)); } 00240 #else 00241 _CRTALIAS int __cdecl __MINGW_NOTHROW _fstat (int _v1, struct _stat* _v2) { return(_fstat32 (_v1,(struct __stat32*)_v2)); } 00242 _CRTALIAS int __cdecl __MINGW_NOTHROW _stat (const char* _v1, struct _stat* _v2) { return(_stat32 (_v1,(struct __stat32*)_v2)); } 00243 _CRTALIAS int __cdecl __MINGW_NOTHROW _fstati64 (int _v1, struct _stati64* _v2) { return(_fstat32i64 (_v1,(struct _stat32i64*)_v2)); } 00244 _CRTALIAS int __cdecl __MINGW_NOTHROW _stati64 (const char* _v1, struct _stati64* _v2) { return(_stat32i64 (_v1,(struct _stat32i64*)_v2)); } 00245 #endif /* !_USE_32BIT_TIME_T */ 00246 #endif /* __MSVCRT_VERSION__ >= 0x0800 */ 00247 00248 00249 #if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */ 00250 #if __MSVCRT_VERSION__ < 0x0800 00251 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat(const wchar_t*, struct _stat*); 00252 _CRTIMP int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t*, struct _stati64*); 00253 #endif 00254 #if __MSVCRT_VERSION__ >= 0x0601 00255 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct __stat64*); 00256 #endif /* __MSVCRT_VERSION__ >= 0x0601 */ 00257 #if __MSVCRT_VERSION__ >= 0x0800 00258 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat32 (const wchar_t*, struct __stat32*); 00259 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat32i64 (const wchar_t*, struct _stat32i64*); 00260 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*); 00261 #ifndef _USE_32BIT_TIME_T 00262 _CRTALIAS int __cdecl __MINGW_NOTHROW _wstat (const wchar_t* _v1, struct _stat* _v2) { return(_wstat64i32 (_v1,(struct _stat64i32*)_v2)); } 00263 _CRTALIAS int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t* _v1, struct _stati64* _v2) { return(_wstat64 (_v1,(struct __stat64*)_v2)); } 00264 #else 00265 _CRTALIAS int __cdecl __MINGW_NOTHROW _wstat (const wchar_t* _v1, struct _stat* _v2) { return(_wstat32 (_v1,(struct __stat32*)_v2)); } 00266 _CRTALIAS int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t* _v1, struct _stati64* _v2) { return(_wstat32i64 (_v1,(struct _stat32i64*)_v2)); } 00267 #endif /* !_USE_32BIT_TIME_T */ 00268 #endif /* __MSVCRT_VERSION__ >= 0x0800 */ 00269 #define _WSTAT_DEFINED 00270 #endif /* _WSTAT_DEFIND */ 00271 #endif /* __MSVCRT__ */ 00272 00273 #ifdef __cplusplus 00274 } 00275 #endif 00276 00277 #endif /* Not RC_INVOKED */ 00278 00279 #endif /* Not _STAT_H_ */
Generated on Tue Jul 12 2022 19:59:55 by
1.7.2