/usr/x86_64-w64-mingw32/include/sys/stat.h is in mingw-w64-x86-64-dev 2.0.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | /**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#ifndef _INC_STAT
#define _INC_STAT
#ifndef _WIN32
#error Only Win32 target is supported!
#endif
#include <_mingw.h>
#include <io.h>
#pragma pack(push,_CRT_PACKING)
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _CRTIMP
#define _CRTIMP __declspec(dllimport)
#endif
#include <sys/types.h>
#ifdef _USE_32BIT_TIME_T
#ifdef _WIN64
#undef _USE_32BIT_TIME_T
#endif
#endif
#ifndef _TIME32_T_DEFINED
typedef long __time32_t;
#define _TIME32_T_DEFINED
#endif
#ifndef _TIME64_T_DEFINED
__MINGW_EXTENSION typedef __int64 __time64_t;
#define _TIME64_T_DEFINED
#endif
#ifndef _TIME_T_DEFINED
#ifdef _USE_32BIT_TIME_T
typedef __time32_t time_t;
#else
typedef __time64_t time_t;
#endif
#define _TIME_T_DEFINED
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
#include <_mingw_stat64.h>
#define _S_IFMT 0xF000
#define _S_IFDIR 0x4000
#define _S_IFCHR 0x2000
#define _S_IFIFO 0x1000
#define _S_IFREG 0x8000
#define _S_IREAD 0x0100
#define _S_IWRITE 0x0080
#define _S_IEXEC 0x0040
_CRTIMP int __cdecl _fstat32(int _FileDes,struct _stat32 *_Stat);
_CRTIMP int __cdecl _stat32(const char *_Name,struct _stat32 *_Stat);
_CRTIMP int __cdecl _fstat64(int _FileDes,struct _stat64 *_Stat);
_CRTIMP int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat);
int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat);
#ifndef __CRT__NO_INLINE
__CRT_INLINE int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat)
{
struct _stat64 st;
int ret=_fstat64(_FileDes,&st);
if (ret == -1) {
memset(_Stat,0,sizeof(struct _stat64i32));
return -1;
}
_Stat->st_dev=st.st_dev;
_Stat->st_ino=st.st_ino;
_Stat->st_mode=st.st_mode;
_Stat->st_nlink=st.st_nlink;
_Stat->st_uid=st.st_uid;
_Stat->st_gid=st.st_gid;
_Stat->st_rdev=st.st_rdev;
_Stat->st_size=(_off_t) st.st_size;
_Stat->st_atime=st.st_atime;
_Stat->st_mtime=st.st_mtime;
_Stat->st_ctime=st.st_ctime;
return ret;
}
#endif /* __CRT__NO_INLINE */
_CRTIMP int __cdecl _stat64(const char *_Name,struct _stat64 *_Stat);
_CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat);
int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat);
#ifndef __CRT__NO_INLINE
__CRT_INLINE int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat)
{
struct _stat64 st;
int ret=_stat64(_Name,&st);
if (ret == -1) {
memset(_Stat,0,sizeof(struct _stat64i32));
return -1;
}
_Stat->st_dev=st.st_dev;
_Stat->st_ino=st.st_ino;
_Stat->st_mode=st.st_mode;
_Stat->st_nlink=st.st_nlink;
_Stat->st_uid=st.st_uid;
_Stat->st_gid=st.st_gid;
_Stat->st_rdev=st.st_rdev;
_Stat->st_size=(_off_t) st.st_size;
_Stat->st_atime=st.st_atime;
_Stat->st_mtime=st.st_mtime;
_Stat->st_ctime=st.st_ctime;
return ret;
}
#endif /* __CRT__NO_INLINE */
#ifndef _WSTAT_DEFINED
#define _WSTAT_DEFINED
_CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat);
_CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat);
int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat);
_CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat);
#endif
#ifndef NO_OLDNAMES
#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
#define S_IFMT _S_IFMT
#define S_IFDIR _S_IFDIR
#define S_IFCHR _S_IFCHR
#define S_IFREG _S_IFREG
#define S_IREAD _S_IREAD
#define S_IWRITE _S_IWRITE
#define S_IEXEC _S_IEXEC
#define S_IFIFO _S_IFIFO
#define S_IFBLK _S_IFBLK
#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
#define _S_IXUSR _S_IEXEC
#define _S_IWUSR _S_IWRITE
#define S_IRWXU _S_IRWXU
#define S_IXUSR _S_IXUSR
#define S_IWUSR _S_IWUSR
#define S_IRUSR _S_IRUSR
#define _S_IRUSR _S_IREAD
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES)
int __cdecl stat(const char *_Filename,struct stat *_Stat);
int __cdecl fstat(int _Desc,struct stat *_Stat);
int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat);
#ifndef __CRT__NO_INLINE
#ifdef _USE_32BIT_TIME_T
__CRT_INLINE int __cdecl
fstat(int _Desc,struct stat *_Stat) {
struct _stat32 st;
int ret=_fstat32(_Desc,&st);
if (ret == -1) {
memset(_Stat,0,sizeof(struct stat));
return -1;
}
/* struct stat and struct _stat32
are the same for this case. */
memcpy(_Stat, &st, sizeof(struct _stat32));
return ret;
}
/* Disable it for making sure trailing slash issue is fixed. */
#if 0
__CRT_INLINE int __cdecl
stat(const char *_Filename,struct stat *_Stat) {
struct _stat32 st;
int ret=_stat32(_Filename,&st);
if (ret == -1) {
memset(_Stat,0,sizeof(struct stat));
return -1;
}
/* struct stat and struct _stat32
are the same for this case. */
memcpy(_Stat, &st, sizeof(struct _stat32));
return ret;
}
#endif
#else
__CRT_INLINE int __cdecl
fstat(int _Desc,struct stat *_Stat) {
struct _stat64 st;
int ret=_fstat64(_Desc,&st);
if (ret == -1) {
memset(_Stat,0,sizeof(struct stat));
return -1;
}
/* struct stat and struct _stat64i32
are the same for this case. */
_Stat->st_dev=st.st_dev;
_Stat->st_ino=st.st_ino;
_Stat->st_mode=st.st_mode;
_Stat->st_nlink=st.st_nlink;
_Stat->st_uid=st.st_uid;
_Stat->st_gid=st.st_gid;
_Stat->st_rdev=st.st_rdev;
_Stat->st_size=(_off_t) st.st_size;
_Stat->st_atime=st.st_atime;
_Stat->st_mtime=st.st_mtime;
_Stat->st_ctime=st.st_ctime;
return ret;
}
/* Disable it for making sure trailing slash issue is fixed. */
#if 0
__CRT_INLINE int __cdecl
stat(const char *_Filename,struct stat *_Stat) {
struct _stat64 st;
int ret=_stat64(_Filename,&st);
if (ret == -1) {
memset(_Stat,0,sizeof(struct stat));
return -1;
}
/* struct stat and struct _stat64i32
are the same for this case. */
_Stat->st_dev=st.st_dev;
_Stat->st_ino=st.st_ino;
_Stat->st_mode=st.st_mode;
_Stat->st_nlink=st.st_nlink;
_Stat->st_uid=st.st_uid;
_Stat->st_gid=st.st_gid;
_Stat->st_rdev=st.st_rdev;
_Stat->st_size=(_off_t) st.st_size;
_Stat->st_atime=st.st_atime;
_Stat->st_mtime=st.st_mtime;
_Stat->st_ctime=st.st_ctime;
return ret;
}
#endif
#endif /* _USE_32BIT_TIME_T */
#endif /* __CRT__NO_INLINE */
#endif /* !RC_INVOKED && !NO_OLDNAMES */
#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
#ifdef _USE_32BIT_TIME_T
#define stat _stat32i64
#define fstat _fstat32i64
#else
#define stat _stat64
#define fstat _fstat64
#endif
#endif
#ifdef __cplusplus
}
#endif
#pragma pack(pop)
#endif /* _INC_STAT */
|