]> code.delx.au - gnu-emacs/blobdiff - nt/inc/ms-w32.h
File synchronization fixes.
[gnu-emacs] / nt / inc / ms-w32.h
index 7b16ccab069401791b7ec67f9d862c18e61804cb..1240239089564d0e0903b21eb1946278dc0a9fd2 100644 (file)
@@ -1,6 +1,6 @@
 /* System description file for Windows NT.
 
-Copyright (C) 1993-1995, 2001-201 Free Software Foundation, Inc.
+Copyright (C) 1993-1995, 2001-2013 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -70,6 +70,18 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define HAVE___BUILTIN_UNWIND_INIT 1
 #endif
 
+/* This isn't perfect, as some systems might have the page file in
+   another place.  Also, I suspect that the time stamp of that file
+   might also change when Windows enlarges the file due to
+   insufficient VM.  Still, this seems to be the most reliable way;
+   the alternative (of using GetSystemTimes) won't work on laptops
+   that hibernate, because the system clock is stopped then.  Other
+   possibility would be to run "net statistics workstation" and parse
+   the output, but that's gross.  So this should do; if the file is
+   not there, the boot time will be returned as zero, and filelock.c
+   already handles that.  */
+#define BOOT_TIME_FILE "C:/pagefile.sys"
+
 /* ============================================================ */
 
 /* Here, add any special hacks needed to make Emacs work on this
@@ -149,7 +161,6 @@ extern char *getenv ();
 #define chdir   sys_chdir
 #undef chmod
 #define chmod   sys_chmod
-#define chown   sys_chown
 #undef close
 #define close   sys_close
 #undef creat
@@ -178,6 +189,10 @@ extern char *getenv ();
 #define strerror sys_strerror
 #undef unlink
 #define unlink  sys_unlink
+/* This prototype is needed because some files include config.h
+   _after_ the standard headers, so sys_unlink gets no prototype from
+   stdio.h or io.h.  */
+extern int sys_unlink (const char *);
 #undef write
 #define write   sys_write
 
@@ -205,6 +220,7 @@ extern char *getenv ();
 /* Map to MSVC names.  */
 #define execlp    _execlp
 #define execvp    _execvp
+#define fdatasync _commit
 #define fdopen   _fdopen
 #ifndef fileno
 #define fileno   _fileno
@@ -218,7 +234,6 @@ typedef int pid_t;
 #define strtoll   _strtoi64
 #endif
 #define isatty    _isatty
-#define logb      _logb
 #define _longjmp  longjmp
 #define lseek     _lseek
 #define popen     _popen
@@ -261,8 +276,11 @@ struct timespec
 extern struct tm *gmtime_r (time_t const * restrict, struct tm * restrict);
 extern struct tm *localtime_r (time_t const * restrict, struct tm * restrict);
 
+#ifdef _MSC_VER
 /* This is hacky, but is necessary to avoid warnings about macro
-   redefinitions using the SDK compilers.  */
+   redefinitions using the MSVC compilers, since, when __STDC__ is
+   undefined or zero, those compilers declare functions like fileno,
+   lseek, and chdir, for which we defined macros above.  */
 #ifndef __STDC__
 #define __STDC__ 1
 #define MUST_UNDEF__STDC__
@@ -274,6 +292,11 @@ extern struct tm *localtime_r (time_t const * restrict, struct tm * restrict);
 #undef __STDC__
 #undef MUST_UNDEF__STDC__
 #endif
+#else  /* !_MSC_VER */
+#include <direct.h>
+#include <io.h>
+#include <stdio.h>
+#endif /* !_MSC_VER */
 
 /* Defines that we need that aren't in the standard signal.h.  */
 #define SIGHUP  1               /* Hang up */
@@ -289,6 +312,10 @@ extern struct tm *localtime_r (time_t const * restrict, struct tm * restrict);
 #define NSIG 23
 #endif
 
+#ifndef ENOTSUP
+#define ENOTSUP ENOSYS
+#endif
+
 #ifdef _MSC_VER
 typedef int sigset_t;
 typedef int ssize_t;
@@ -376,9 +403,19 @@ extern char *get_emacs_configuration_options (void);
 #define sys_nerr _sys_nerr
 #endif
 
+/* This must be after including stdlib.h, which defines putenv on MinGW.  */
+#ifdef putenv
+# undef putenv
+#endif
+#define putenv    sys_putenv
+extern int sys_putenv (char *);
+
 extern int getloadavg (double *, int);
 extern int getpagesize (void);
 
+extern void * memrchr (void const *, int, size_t);
+
+
 #if defined (__MINGW32__)
 
 /* Define to 1 if the system has the type `long long int'. */