]> code.delx.au - gnu-emacs/blobdiff - nt/inc/sys/stat.h
Rework C source files to avoid ^(
[gnu-emacs] / nt / inc / sys / stat.h
index 45689d24776c38852e06f9f224140a9d4deebb17..45bc2ea1e0c5b94421b4101a315f3cdd39df4ea5 100644 (file)
@@ -1,14 +1,14 @@
 /* sys/stat.h supplied with MSVCRT uses too narrow data types for
    inode and user/group id, so we replace them with our own.
 
-Copyright (C) 2008-2013 Free Software Foundation, Inc.
+Copyright (C) 2008-2016 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -83,6 +83,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define S_TYPEISSHM(p) 0
 #define S_TYPEISTMO(p) 0
 
+#define UTIME_NOW  (-1)
+#define UTIME_OMIT (-2)
+
 struct stat {
   unsigned __int64 st_ino;     /* ino_t in sys/types.h is too narrow */
   dev_t st_dev;
@@ -99,17 +102,58 @@ struct stat {
   char            st_gname[260];
 };
 
+/* These are here to avoid compiler warnings when using wchar.h.  */
+struct _stat
+{
+       _dev_t  st_dev;         /* Equivalent to drive number 0=A 1=B ... */
+       _ino_t  st_ino;         /* Always zero ? */
+       _mode_t st_mode;        /* See above constants */
+       short   st_nlink;       /* Number of links. */
+       short   st_uid;         /* User: Maybe significant on NT ? */
+       short   st_gid;         /* Group: Ditto */
+       _dev_t  st_rdev;        /* Seems useless (not even filled in) */
+       _off_t  st_size;        /* File size in bytes */
+       time_t  st_atime;       /* Accessed date (always 00:00 hrs local
+                                * on FAT) */
+       time_t  st_mtime;       /* Modified time */
+       time_t  st_ctime;       /* Creation time */
+};
+
+#if defined (__MSVCRT__)
+struct _stati64 {
+    _dev_t st_dev;
+    _ino_t st_ino;
+    _mode_t st_mode;
+    short st_nlink;
+    short st_uid;
+    short st_gid;
+    _dev_t st_rdev;
+    __int64 st_size;
+    time_t st_atime;
+    time_t st_mtime;
+    time_t st_ctime;
+};
+#endif
+
 /* Internal variable for asking 'stat'/'lstat' to produce accurate
    info about owner and group of files. */
 extern int w32_stat_get_owner_group;
 
 /* Prevent redefinition by other headers, e.g. wchar.h.  */
 #define _STAT_DEFINED
-
-_CRTIMP int __cdecl __MINGW_NOTHROW    fstat (int, struct stat*);
-_CRTIMP int __cdecl __MINGW_NOTHROW    chmod (const char*, int);
-_CRTIMP int __cdecl __MINGW_NOTHROW    stat (const char*, struct stat*);
-_CRTIMP int __cdecl __MINGW_NOTHROW    lstat (const char*, struct stat*);
+/* This prevents definition in MinGW's wchar.h of inline functions
+   that use struct _stat64i32 etc., which we don't define and don't
+   support in our implementation of 'stat' and 'fstat'.  If we don't
+   prevent definition of those inline functions, any program (e.g.,
+   test programs run by configure) that includes both wchar.h and
+   sys/stat.h will fail to compile.  */
+#define _WSTAT_DEFINED
+
+int __cdecl __MINGW_NOTHROW    fstat (int, struct stat*);
+int __cdecl __MINGW_NOTHROW    stat (const char*, struct stat*);
+int __cdecl __MINGW_NOTHROW    lstat (const char*, struct stat*);
+int __cdecl __MINGW_NOTHROW    fstatat (int, char const *,
+                                                struct stat *, int);
+int __cdecl __MINGW_NOTHROW    chmod (const char*, int);
 
 #endif /* INC_SYS_STAT_H_ */
-