4 * Symbolic constants for opening and creating files, also stat, fstat and
7 * This file is part of the Mingw32 package.
10 * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
12 * THIS SOFTWARE IS NOT COPYRIGHTED
14 * This source code is offered for use in the public domain. You may
15 * use, modify or distribute it freely.
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.
28 #ifndef __STRICT_ANSI__
33 #include <msvcrt/sys/types.h>
42 #define _WCHAR_T_DEFINED
43 #ifndef __WCHAR_TYPE__
44 #define __WCHAR_TYPE__ short unsigned int
47 typedef __WCHAR_TYPE__ wchar_t;
49 #endif /* wchar_t not already defined */
53 * Constants for the stat st_mode member.
55 #define S_IFIFO 0x1000 /* FIFO */
56 #define S_IFCHR 0x2000 /* Character */
57 #define S_IFBLK 0x3000 /* Block */
58 #define S_IFDIR 0x4000 /* Directory */
59 #define S_IFREG 0x8000 /* Regular */
61 #define S_IFMT 0xF000 /* File type mask */
63 #define S_IEXEC 0x0040
64 #define S_IWRITE 0x0080
65 #define S_IREAD 0x0100
67 #define S_ISDIR(m) ((m) & S_IFDIR)
68 #define S_ISFIFO(m) ((m) & S_IFIFO)
69 #define S_ISCHR(m) ((m) & S_IFCHR)
70 #define S_ISBLK(m) ((m) & S_IFBLK)
71 #define S_ISREG(m) ((m) & S_IFREG)
73 #define S_IRWXU (S_IREAD | S_IWRITE | S_IEXEC)
74 #define S_IXUSR S_IEXEC
75 #define S_IWUSR S_IWRITE
76 #define S_IRUSR S_IREAD
78 #define _S_IEXEC S_IEXEC
79 #define _S_IREAD S_IREAD
80 #define _S_IWRITE S_IWRITE
83 * The structure manipulated and returned by stat and fstat.
85 * NOTE: If called on a directory the values in the time fields are not only
86 * invalid, they will cause localtime et. al. to return NULL. And calling
87 * asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
91 long st_dev; /* Equivalent to drive number 0=A 1=B ... */
92 short st_ino; /* Always zero ? */
93 short st_mode; /* See above constants */
94 short st_nlink; /* Number of links. */
95 int st_uid; /* User: Maybe significant on NT ? */
96 short st_gid; /* Group: Ditto */
97 short st_rdev; /* Seems useless (not even filled in) */
98 long st_size; /* File size in bytes */
99 time_t st_atime; /* Accessed date (always 00:00 hrs local
101 time_t st_mtime; /* Modified time */
102 time_t st_ctime; /* Creation time */
107 short st_dev; /* Equivalent to drive number 0=A 1=B ... */
108 short st_ino; /* Always zero ? */
109 short st_mode; /* See above constants */
110 short st_nlink; /* Number of links. */
111 int st_uid; /* User: Maybe significant on NT ? */
112 short st_gid; /* Group: Ditto */
113 short st_rdev; /* Seems useless (not even filled in) */
114 __int64 st_size; /* File size in bytes */
115 time_t st_atime; /* Accessed date (always 00:00 hrs local
117 time_t st_mtime; /* Modified time */
118 time_t st_ctime; /* Creation time */
121 int _fstat (int nFileNo, struct stat* pstat);
122 __int64 _fstati64 (int nFileNo, struct _stati64* pstat);
123 int _stat (const char* szPath, struct stat* pstat);
124 __int64 _stati64 (const char* szPath, struct _stati64* pstat);
125 int _wstat (const wchar_t* szPath, struct stat* pstat);
126 __int64 _wstati64 (const wchar_t* szPath, struct _stati64* pstat);
130 #define fstat(nFileNo, pstat) _fstat(nFileNo, pstat)
131 #define stat(szPath,pstat) _stat(szPath,pstat)
133 #endif /* Not _NO_OLDNAMES */
140 #endif /* Not _STAT_H_ */
142 #endif /* Not __STRICT_ANSI__ */