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 * DISCLAIMED. This includes but is not limited to warranties of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24 * $Date: 2005/04/17 13:14:29 $
28 #ifndef __STRICT_ANSI__
33 /* All the headers include this file. */
37 #define __need_wchar_t
40 #endif /* Not RC_INVOKED */
42 #include <sys/types.h>
45 * Constants for the stat st_mode member.
47 #define _S_IFIFO 0x1000 /* FIFO */
48 #define _S_IFCHR 0x2000 /* Character */
49 #define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
50 #define _S_IFDIR 0x4000 /* Directory */
51 #define _S_IFREG 0x8000 /* Regular */
53 #define _S_IFMT 0xF000 /* File type mask */
55 #define _S_IEXEC 0x0040
56 #define _S_IWRITE 0x0080
57 #define _S_IREAD 0x0100
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
64 #define _S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
65 #define _S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
66 #define _S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR)
67 #define _S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK)
68 #define _S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
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
86 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
87 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
88 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
89 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
90 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
92 #endif /* Not _NO_OLDNAMES */
98 * The structure manipulated and returned by stat and fstat.
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!
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
116 time_t st_mtime
; /* Modified time */
117 time_t st_ctime
; /* Creation time */
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
132 time_t st_mtime
; /* Modified time */
133 time_t st_ctime
; /* Creation time */
135 #if defined (__MSVCRT__)
139 unsigned short st_mode
;
149 #endif /* __MSVCRT__ */
150 #define _STAT_DEFINED
151 #endif /* _STAT_DEFINED */
157 int _fstat (int, struct _stat
*);
158 int _chmod (const char*, int);
159 int _stat (const char*, struct _stat
*);
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__ */
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
*);
178 #endif /* Not _NO_OLDNAMES */
185 #endif /* Not RC_INVOKED */
187 #endif /* Not _STAT_H_ */
189 #endif /* Not __STRICT_ANSI__ */