msvcrt: struct stat

Dimitrie O. Paun dpaun at
Sun Jan 12 09:56:41 CST 2003

It's implemented similarly in mingw as well, and it's better than
a define anyway. The (funny) reason we need this now is that before
we had a:
  #define stat _stat
which worked both for the struct stat, as well as for the function
stat(). Since the define got removed by the inline stat() definition,
we no longer have a struct stat :).

  Define the (old name) struct stat, it is used by programs using
  the old names.

Index: include/msvcrt/sys/stat.h
RCS file: /var/cvs/wine/include/msvcrt/sys/stat.h,v
retrieving revision 1.7
diff -u -r1.7 stat.h
--- include/msvcrt/sys/stat.h	11 Jan 2003 22:49:54 -0000	1.7
+++ include/msvcrt/sys/stat.h	12 Jan 2003 15:45:13 -0000
@@ -83,6 +83,20 @@
   MSVCRT(time_t) st_ctime;
+struct stat {
+  _dev_t         st_dev;
+  _ino_t         st_ino;
+  unsigned short st_mode;
+  short          st_nlink;
+  short          st_uid;
+  short          st_gid;
+  _dev_t         st_rdev;
+  MSVCRT(_off_t) st_size;
+  MSVCRT(time_t) st_atime;
+  MSVCRT(time_t) st_mtime;
+  MSVCRT(time_t) st_ctime;
 struct _stati64 {
   _dev_t         st_dev;
   _ino_t         st_ino;
@@ -128,8 +142,8 @@
 #define S_IEXEC  _S_IEXEC
-static inline int fstat(int fd, struct _stat* ptr) { return _fstat(fd, ptr); }
-static inline int stat(const char* path, struct _stat* ptr) { return _stat(path, ptr); }
+static inline int fstat(int fd, struct stat* ptr) { return _fstat(fd, (struct _stat*)ptr); }
+static inline int stat(const char* path, struct stat* ptr) { return _stat(path, (struct _stat*)ptr); }
 static inline int umask(int fd) { return _umask(fd); }


More information about the wine-patches mailing list