summaryrefslogtreecommitdiff
path: root/nt/inc
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2013-03-28 20:13:59 +0200
committerEli Zaretskii <eliz@gnu.org>2013-03-28 20:13:59 +0200
commitd76bf86f438d4f5f9fe493ab76f02ffc78f3ae2e (patch)
tree04fa8bc7bd2058a316a7ee30f8741d25bfd0b060 /nt/inc
parent2ef26ceb192c7683754cf0b4aa3087f501254332 (diff)
parente74aeda863cd6896e06e92586f87b45d63d67d15 (diff)
downloademacs-d76bf86f438d4f5f9fe493ab76f02ffc78f3ae2e.tar.gz
Merge from trunk and resolve conflicts.
Diffstat (limited to 'nt/inc')
-rw-r--r--nt/inc/dirent.h2
-rw-r--r--nt/inc/grp.h2
-rw-r--r--nt/inc/inttypes.h2
-rw-r--r--nt/inc/langinfo.h2
-rw-r--r--nt/inc/ms-w32.h85
-rw-r--r--nt/inc/nl_types.h2
-rw-r--r--nt/inc/stdint.h4
-rw-r--r--nt/inc/sys/acl.h25
-rw-r--r--nt/inc/sys/socket.h2
-rw-r--r--nt/inc/sys/stat.h18
-rw-r--r--nt/inc/sys/time.h6
-rw-r--r--nt/inc/sys/wait.h2
-rw-r--r--nt/inc/unistd.h6
13 files changed, 133 insertions, 25 deletions
diff --git a/nt/inc/dirent.h b/nt/inc/dirent.h
index 618f3beddf0..676b82d207b 100644
--- a/nt/inc/dirent.h
+++ b/nt/inc/dirent.h
@@ -30,7 +30,7 @@ typedef struct
char dd_buf[DIRBLKSIZ]; /* directory block */
} DIR; /* stream data from opendir() */
-extern DIR *opendir (char *);
+extern DIR *opendir (const char *);
extern struct dirent *readdir (DIR *);
extern void seekdir (DIR *, long);
extern void closedir (DIR *);
diff --git a/nt/inc/grp.h b/nt/inc/grp.h
index 3d369044974..02c0ef7f3a0 100644
--- a/nt/inc/grp.h
+++ b/nt/inc/grp.h
@@ -1,6 +1,6 @@
/* Replacement grp.h file for building GNU Emacs on Windows.
-Copyright (C) 2003-2012 Free Software Foundation, Inc.
+Copyright (C) 2003-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/nt/inc/inttypes.h b/nt/inc/inttypes.h
index 688b9bc9223..4629ccb038c 100644
--- a/nt/inc/inttypes.h
+++ b/nt/inc/inttypes.h
@@ -1,6 +1,6 @@
/* Replacement inntypes.h file for building GNU Emacs on Windows with MSVC.
-Copyright (C) 2011-2012 Free Software Foundation, Inc.
+Copyright (C) 2011-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/nt/inc/langinfo.h b/nt/inc/langinfo.h
index 7ab36f0a998..93a56e548c7 100644
--- a/nt/inc/langinfo.h
+++ b/nt/inc/langinfo.h
@@ -1,6 +1,6 @@
/* Replacement langinfo.h file for building GNU Emacs on Windows.
-Copyright (C) 2006-2012 Free Software Foundation, Inc.
+Copyright (C) 2006-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 7b16ccab069..cd183c917c4 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -1,6 +1,6 @@
/* System description file for Windows NT.
-Copyright (C) 1993-1995, 2001-2012 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
@@ -115,6 +127,17 @@ typedef unsigned short mode_t;
extern char *getenv ();
#endif
+/* Prevent accidental use of features unavailable in older Windows
+ versions we still support. MinGW64 defines this to a higher value
+ in its system headers, and is not really compatible with values
+ lower than 0x0500, so leave it alone. */
+#ifndef _W64
+# define _WIN32_WINNT 0x0400
+#endif
+
+/* Make a leaner executable. */
+#define WIN32_LEAN_AND_MEAN 1
+
#ifdef HAVE_STRINGS_H
#include "strings.h"
#endif
@@ -133,6 +156,21 @@ extern char *getenv ();
#ifdef emacs
+#ifdef _W64
+/* MinGW64 specific stuff. */
+/* Make sure 'struct timespec' and 'struct timezone' are defined. */
+#include <sys/types.h>
+#include <time.h>
+/* This prototype avoids MinGW64 compiler warnings due to the fact
+ that time.h is included before localtime is redirected to
+ sys_localtime below. */
+extern struct tm * sys_localtime (const time_t *);
+/* MinGW64 uses a 2-argument _setjmp, and setjmp is a macro defined to
+ supply the 2nd arg correctly, so don't use _setjmp directly in that
+ case. */
+#undef HAVE__SETJMP
+#endif
+
#ifdef _MSC_VER
#include <sys/timeb.h>
#include <sys/stat.h>
@@ -149,7 +187,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 +215,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 +246,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 +260,6 @@ typedef int pid_t;
#define strtoll _strtoi64
#endif
#define isatty _isatty
-#define logb _logb
#define _longjmp longjmp
#define lseek _lseek
#define popen _popen
@@ -251,18 +292,24 @@ int _getpid (void);
/* 'struct timespec' is used by time-related functions in lib/ and
elsewhere, but we don't use lib/time.h where the structure is
defined. */
+/* MinGW64 defines 'struct timespec' and _TIMESPEC_DEFINED in sys/types.h. */
+#ifndef _TIMESPEC_DEFINED
struct timespec
{
time_t tv_sec; /* seconds */
long int tv_nsec; /* nanoseconds */
};
+#endif
/* Required for functions in lib/time_r.c, since we don't use lib/time.h. */
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 +321,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,11 +341,19 @@ 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;
#endif
+#ifndef _POSIX /* MinGW64 */
+typedef _sigset_t sigset_t;
+#endif
+
typedef void (_CALLBACK_ *signal_handler) (int);
extern signal_handler sys_signal (int, signal_handler);
@@ -339,13 +399,6 @@ extern char *get_emacs_configuration_options (void);
#define _WINSOCKAPI_ 1
#define _WINSOCK_H
-/* Prevent accidental use of features unavailable in
- older Windows versions we still support. */
-#define _WIN32_WINNT 0x0400
-
-/* Make a leaner executable. */
-#define WIN32_LEAN_AND_MEAN 1
-
/* Defines size_t and alloca (). */
#ifdef emacs
#define malloc e_malloc
@@ -376,9 +429,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'. */
diff --git a/nt/inc/nl_types.h b/nt/inc/nl_types.h
index 3d3a162bada..e3eb9eb5477 100644
--- a/nt/inc/nl_types.h
+++ b/nt/inc/nl_types.h
@@ -1,6 +1,6 @@
/* Replacement nl_types.h file for building GNU Emacs on Windows.
-Copyright (C) 2006-2012 Free Software Foundation, Inc.
+Copyright (C) 2006-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/nt/inc/stdint.h b/nt/inc/stdint.h
index 97c9bbdaee9..c8b3aba0916 100644
--- a/nt/inc/stdint.h
+++ b/nt/inc/stdint.h
@@ -1,6 +1,6 @@
/* Replacement stdint.h file for building GNU Emacs on Windows.
-Copyright (C) 2011-2012 Free Software Foundation, Inc.
+Copyright (C) 2011-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -38,6 +38,7 @@ typedef unsigned __int64 uint64_t;
#define INT64_MIN (~INT64_MAX)
#define INTPTR_MAX INT64_MAX
#define INTPTR_MIN INT64_MIN
+#define UINTPTR_MAX UINT64_MAX
#define UINTMAX_MAX UINT64_MAX
#define UINTMAX_MIN UINT64_MIN
#define INTMAX_MAX INT64_MAX
@@ -53,6 +54,7 @@ typedef unsigned int uint32_t;
#define INT32_MIN (~INT32_MAX)
#define INTPTR_MAX INT32_MAX
#define INTPTR_MIN INT32_MIN
+#define UINTPTR_MAX UINT32_MAX
#define UINTMAX_MAX UINT32_MAX
#define UINTMAX_MIN UINT32_MIN
#define INTMAX_MAX INT32_MAX
diff --git a/nt/inc/sys/acl.h b/nt/inc/sys/acl.h
new file mode 100644
index 00000000000..3133e3bfc09
--- /dev/null
+++ b/nt/inc/sys/acl.h
@@ -0,0 +1,25 @@
+/* Emulation of Posix ACLs for Windows. */
+
+#ifndef ACL_H
+#define ACL_H
+
+#define NOMINMAX 1 /* don't define min and max */
+#include <windows.h>
+
+typedef PSECURITY_DESCRIPTOR acl_t;
+typedef unsigned acl_type_t;
+
+/* Values of acl_type_t */
+#define ACL_TYPE_ACCESS 0
+#define ACL_TYPE_DEFAULT 1
+
+typedef unsigned acl_perm_t;
+
+extern int acl_valid (acl_t);
+extern acl_t acl_get_file (const char *, acl_type_t);
+extern int acl_set_file (const char *, acl_type_t, acl_t);
+extern char * acl_to_text (acl_t, ssize_t *);
+extern acl_t acl_from_text (const char *);
+extern int acl_free (void *);
+
+#endif /* ACL_H */
diff --git a/nt/inc/sys/socket.h b/nt/inc/sys/socket.h
index 1c8be6c452f..99227d75d28 100644
--- a/nt/inc/sys/socket.h
+++ b/nt/inc/sys/socket.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 2001-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/nt/inc/sys/stat.h b/nt/inc/sys/stat.h
index b673b80a0e3..f6785c56477 100644
--- a/nt/inc/sys/stat.h
+++ b/nt/inc/sys/stat.h
@@ -1,7 +1,7 @@
/* 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-2012 Free Software Foundation, Inc.
+Copyright (C) 2008-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -74,6 +74,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define S_ISDOOR(m) 0
#define S_ISMPB(m) 0
#define S_ISMPC(m) 0
+#define S_ISMPX(m) 0
#define S_ISNWK(m) 0
#define S_ISPORT(m) 0
#define S_ISWHT(m) 0
@@ -98,13 +99,18 @@ struct stat {
char st_gname[260];
};
+/* 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*);
+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_ */
-
diff --git a/nt/inc/sys/time.h b/nt/inc/sys/time.h
index 2d2c3abe222..aa51041bcd8 100644
--- a/nt/inc/sys/time.h
+++ b/nt/inc/sys/time.h
@@ -6,6 +6,9 @@
* have the below stuff.
*/
+/* The guards are for MinGW64, which defines these structs on its
+ system headers which are included by ms-w32.h. */
+#ifndef _W64
/* Allow inclusion of sys/time.h and winsock2.h in any order. Needed
for running the configure test, which is only relevant to MinGW. */
#ifndef _TIMEVAL_DEFINED
@@ -22,12 +25,15 @@ struct timeval
((tvp)->tv_usec cmp (uvp)->tv_usec))
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
#endif /* _TIMEVAL_DEFINED */
+#endif /* _W64 */
+#ifndef _TIMEZONE_DEFINED
struct timezone
{
int tz_minuteswest; /* minutes west of Greenwich */
int tz_dsttime; /* type of dst correction */
};
+#endif
void gettimeofday (struct timeval *, struct timezone *);
diff --git a/nt/inc/sys/wait.h b/nt/inc/sys/wait.h
index 8d890c9e175..d192453ff57 100644
--- a/nt/inc/sys/wait.h
+++ b/nt/inc/sys/wait.h
@@ -1,6 +1,6 @@
/* A limited emulation of sys/wait.h on Posix systems.
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2012-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
diff --git a/nt/inc/unistd.h b/nt/inc/unistd.h
index b75e7d7d6bf..8ad8cf213b1 100644
--- a/nt/inc/unistd.h
+++ b/nt/inc/unistd.h
@@ -15,6 +15,7 @@
and whose prototypes are usually found in unistd.h on POSIX
platforms. */
extern ssize_t readlink (const char *, char *, size_t);
+extern ssize_t readlinkat (int, const char *, char *, size_t);
extern int symlink (char const *, char const *);
extern int setpgid (pid_t, pid_t);
extern pid_t getpgrp (void);
@@ -29,6 +30,11 @@ extern int faccessat (int, char const *, int, int);
#define AT_EACCESS 4
#define AT_SYMLINK_NOFOLLOW 4096
+#define O_IGNORE_CTTY 0
#define O_NOCTTY 0
+#define O_NOFOLLOW 0
+
+/* This is normally on stdlib.h, but we don't override that header. */
+extern int unsetenv (const char *);
#endif /* _UNISTD_H */