Navit SVN

/work/compile/navit/src/navit/support/libc/sys/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__ */
00151 #endif /* __MSVCRT__ */
00152 #define _STAT_DEFINED
00153 #endif /* _STAT_DEFINED */
00154 
00155 #ifdef  __cplusplus
00156 extern "C" {
00157 #endif
00158 
00159 _CRTIMP int __cdecl __MINGW_NOTHROW     _fstat (int, struct _stat*);
00160 _CRTIMP int __cdecl __MINGW_NOTHROW     _chmod (const char*, int);
00161 _CRTIMP int __cdecl __MINGW_NOTHROW     _stat (const char*, struct _stat*);
00162 
00163 #ifndef _NO_OLDNAMES
00164 
00165 /* These functions live in liboldnames.a. */
00166 _CRTIMP int __cdecl __MINGW_NOTHROW     fstat (int, struct stat*);
00167 _CRTIMP int __cdecl __MINGW_NOTHROW     chmod (const char*, int);
00168 _CRTIMP int __cdecl __MINGW_NOTHROW     stat (const char*, struct stat*);
00169 
00170 #endif  /* Not _NO_OLDNAMES */
00171 
00172 #if defined (__MSVCRT__)
00173 _CRTIMP int __cdecl __MINGW_NOTHROW  _fstati64(int, struct _stati64 *);
00174 _CRTIMP int __cdecl __MINGW_NOTHROW  _stati64(const char *, struct _stati64 *);
00175 /* These require newer versions of msvcrt.dll (6.10 or higher).  */ 
00176 #if __MSVCRT_VERSION__ >= 0x0601
00177 _CRTIMP int __cdecl __MINGW_NOTHROW _fstat64 (int, struct __stat64*);
00178 _CRTIMP int __cdecl __MINGW_NOTHROW _stat64 (const char*, struct __stat64*);
00179 #endif /* __MSVCRT_VERSION__ >= 0x0601 */
00180 #if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */
00181 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstat(const wchar_t*, struct _stat*);
00182 _CRTIMP int __cdecl __MINGW_NOTHROW     _wstati64 (const wchar_t*, struct _stati64*);
00183 #if __MSVCRT_VERSION__ >= 0x0601
00184 _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct __stat64*);
00185 #endif /* __MSVCRT_VERSION__ >= 0x0601 */
00186 #define _WSTAT_DEFINED
00187 #endif /* _WSTAT_DEFIND */
00188 #endif /* __MSVCRT__ */
00189 
00190 #ifdef  __cplusplus
00191 }
00192 #endif
00193 
00194 #endif  /* Not RC_INVOKED */
00195 
00196 #endif  /* Not _STAT_H_ */