diff --git a/lib-src/profile.c b/lib-src/profile.c
index 3e642237c6b..02471d89da8 100644
--- a/lib-src/profile.c
+++ b/lib-src/profile.c
@@ -20,7 +20,7 @@ along with GNU Emacs. If not, see . */
/**
- ** To be run as an emacs process. Input string that starts with:
+ ** To be run as an emacs subprocess. Input string that starts with:
** 'z' -- resets the watch (to zero).
** 'p' -- return time (on stdout) as string with format .
** 'q' -- exit.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4d0f1e5afeb..ca425d5b5ea 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2012-06-30 Eli Zaretskii
+
+ * emacs-lisp/timer.el (timer-until): Subtract results of
+ float-time, instead of taking float-time of the result of
+ time-subtract, since float-time signals an error for negative time
+ arguments.
+
2012-06-30 Chong Yidong
* xml.el (xml-*-re): Convert defvars into defconsts, and
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index eab96fe202a..a66d5972d82 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -268,7 +268,7 @@ how many will really happen."
"Calculate number of seconds from when TIMER will run, until TIME.
TIMER is a timer, and stands for the time when its next repeat is scheduled.
TIME is a time-list."
- (float-time (time-subtract time (timer--time timer))))
+ (- (float-time time) (float-time (timer--time timer))))
(defun timer-event-handler (timer)
"Call the handler for the timer TIMER.
diff --git a/msdos/ChangeLog b/msdos/ChangeLog
index 1e156563e06..f0c3703f36c 100644
--- a/msdos/ChangeLog
+++ b/msdos/ChangeLog
@@ -1,3 +1,32 @@
+2012-06-30 Eli Zaretskii
+
+ * mainmake.v2 (bootstrap-clean): Do a maintainer-clean in lib, not
+ bootstrap-clean (which doesn't exist).
+
+ * inttypes.h (PRIuMAX) [__DJGPP__ < 2.04]: Define to "llu".
+
+ * sedleim.inp (MKDIR_P): Edit to DOS "md" command.
+
+ * sed1v2.inp: (LIB_CLOCK_GETTIME): Edit to empty.
+ Remove lines that invoke PAXCTL.
+ (clean): Fix recipe not to run Unixy shell commands.
+
+ * sed2v2.inp (GETTIMEOFDAY_TIMEZONE): Edit to 'struct timezone'.
+ (HAVE_STRNCASECMP): Edit to 1.
+
+ * sed3v2.inp (LIB_CLOCK_GETTIME): Edit to empty.
+ (C_SWITCH_SYSTEM): Add "-I../msdos".
+
+ * sedlibmk.inp (GNULIB_GETTIMEOFDAY, GNULIB_PSELECT)
+ (GNULIB_SELECT, HAVE_STRUCT_TIMEVAL, HAVE_SYS_SELECT_H)
+ (HAVE_SYS_TIME_H, NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H)
+ (NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H, NEXT_SYS_SELECT_H)
+ (NEXT_SYS_TIME_H, REPLACE_GETTIMEOFDAY, REPLACE_PSELECT)
+ (REPLACE_STRUCT_TIMEVAL): Edit to appropriate values.
+ (BUILT_SOURCES): Edit out sys/select.h and sys/time.h.
+ (mostlyclean-local, distclean-generic): Fix recipe not to run
+ Unixy shell commands.
+
2012-06-26 Paul Eggert
Clean out last vestiges of the old HAVE_CONFIG_H stuff.
diff --git a/msdos/inttypes.h b/msdos/inttypes.h
index 6128cbf3155..dba56f83760 100644
--- a/msdos/inttypes.h
+++ b/msdos/inttypes.h
@@ -31,6 +31,7 @@ along with GNU Emacs. If not, see . */
#include
#define strtoumax strtoull
#define strtoimax strtoll
+#define PRIuMAX "llu"
#endif /* __DJGPP__ < 2.04 */
#endif
diff --git a/msdos/mainmake.v2 b/msdos/mainmake.v2
index b4837b99fb9..e1e646a855c 100644
--- a/msdos/mainmake.v2
+++ b/msdos/mainmake.v2
@@ -269,7 +269,7 @@ extraclean:
bootstrap-clean: FRC
cd lib
- $(MAKE) $(MFLAGS) $@
+ -$(MAKE) $(MFLAGS) maintainer-clean
cd ..
cd src
$(MAKE) $(MFLAGS) $@
diff --git a/msdos/sed1v2.inp b/msdos/sed1v2.inp
index b9e94afea51..b2ce4b327dc 100644
--- a/msdos/sed1v2.inp
+++ b/msdos/sed1v2.inp
@@ -105,6 +105,7 @@ s/\.h\.in/.h-in/
/^LIBRESOLV *=/s/@LIBRESOLV@//
/^LIBSELINUX_LIBS *=/s/@LIBSELINUX_LIBS@//
/^LIB_PTHREAD_SIGMASK *=/s/@[^@\n]*@//
+/^LIB_CLOCK_GETTIME *=/s/@[^@\n]*@//g
/^LIBGNUTLS_LIBS *=/s/@[^@\n]*@//
/^LIBGNUTLS_CFLAGS *=/s/@[^@\n]*@//
/^GETLOADAVG_LIBS *=/s/@[^@\n]*@//
@@ -137,6 +138,8 @@ s/\.h\.in/.h-in/
/^[ ]*$/d
/^ if test -f/,/^ fi$/c\
command.com /c if exist .gdbinit rm -f _gdbinit
+/^ *test "X\$(PAXCTL)" = X/d
+/^ *test "\$(CANNOT_DUMP)" = "yes"/d
/^ if test "\$(CANNOT_DUMP)" =/,/^ else /d
/^ fi/d
/^ *LC_ALL=C \$(RUN_TEMACS)/i\
@@ -198,3 +201,4 @@ s/ \$(DBUS_CFLAGS)//
s| -I\$(srcdir)/../lib||
# Add our local inttypes.h to prerequisites where needed
/^lread\.o:/s|lread\.c|& ../msdos/inttypes.h|
+/^ *test "X/d
diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp
index 85ab02c877e..853c64fb178 100644
--- a/msdos/sed2v2.inp
+++ b/msdos/sed2v2.inp
@@ -45,10 +45,12 @@
/^#undef HAVE_MEMMOVE *$/s/^.*$/#define HAVE_MEMMOVE 1/
/^#undef HAVE_SETRLIMIT *$/s/^.*$/#define HAVE_SETRLIMIT 1/
/^#undef HAVE_GETRUSAGE *$/s/^.*$/#define HAVE_GETRUSAGE 1/
+/^#undef GETTIMEOFDAY_TIMEZONE *$/s/^.*$/#define GETTIMEOFDAY_TIMEZONE struct timezone/
/^#undef HAVE_TM_GMTOFF *$/s/^.*$/#define HAVE_TM_GMTOFF 1/
/^#undef HAVE_STRUCT_TIMEZONE *$/s/^.*$/#define HAVE_STRUCT_TIMEZONE 1/
/^#undef HAVE_SIZE_T *$/s/^.*$/#define HAVE_SIZE_T 1/
/^#undef HAVE_MKSTEMP *$/s/^.*$/#define HAVE_MKSTEMP 1/
+/^#undef HAVE_STRNCASECMP *$/s/^.*$/#define HAVE_STRNCASECMP 1/
/^#undef HAVE_STRUCT_TM_TM_ZONE *$/s/^.*$/#define HAVE_STRUCT_TM_TM_ZONE 1/
/^#undef HAVE_SYNC *$/s/^.*$/#define HAVE_SYNC 1/
/^#undef HAVE___BUILTIN_UNWIND_INIT *$/s/^.*$/#define HAVE___BUILTIN_UNWIND_INIT 1/
diff --git a/msdos/sed3v2.inp b/msdos/sed3v2.inp
index faa57996a25..bfa008b3e81 100644
--- a/msdos/sed3v2.inp
+++ b/msdos/sed3v2.inp
@@ -35,8 +35,9 @@ s/-DVERSION[^ ]* //
/^LIBRESOLV *=/s/@[^@\n]*@//g
/^LIBS_MAIL *=/s/@[^@\n]*@//g
/^LIBS_SYSTEM *=/s/@[^@\n]*@//g
+/^LIB_CLOCK_GETTIME *=/s/@[^@\n]*@//g
/^CFLAGS *=/s!=.*$!=-O2 -g!
-/^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS!
+/^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS -I../msdos!
/^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@//
/^WARN_CFLAGS *=/s/@WARN_CFLAGS@//
/^WERROR_CFLAGS *=/s/@WERROR_CFLAGS@//
diff --git a/msdos/sedleim.inp b/msdos/sedleim.inp
index 41f87d92047..461a2b7a9ec 100644
--- a/msdos/sedleim.inp
+++ b/msdos/sedleim.inp
@@ -35,6 +35,8 @@ s|\([ ]\)echo|\1djecho|g
export EMACSLOADPATH=${buildlisppath}\
RUN_EMACS = ${EMACS} -batch --no-site-file
+/^MKDIR_P *=/s,@MKDIR_P@,command.com /c md,
+
/^ cd ../c\
${MAKE} -C ../src ${MFLAGS} emacs
diff --git a/msdos/sedlibmk.inp b/msdos/sedlibmk.inp
index 31335e1e8c6..40b94acf107 100644
--- a/msdos/sedlibmk.inp
+++ b/msdos/sedlibmk.inp
@@ -211,6 +211,7 @@ am__cd = cd
/^GNULIB_GETPAGESIZE *=/s/@GNULIB_GETPAGESIZE@/0/
/^GNULIB_GL_UNISTD_H_GETOPT *=/s/@GNULIB_GL_UNISTD_H_GETOPT@/1/
/^GNULIB_GETSUBOPT *=/s/@GNULIB_GETSUBOPT@/0/
+/^GNULIB_GETTIMEOFDAY *=/s/@GNULIB_GETTIMEOFDAY@/0/
/^GNULIB_GETUSERSHELL *=/s/@GNULIB_GETUSERSHELL@/0/
/^GNULIB_GRANTPT *=/s/@GNULIB_GRANTPT@/0/
/^GNULIB_GROUP_MEMBER *=/s/@GNULIB_GROUP_MEMBER@/0/
@@ -246,6 +247,7 @@ am__cd = cd
/^GNULIB_PREAD *=/s/@GNULIB_PREAD@/0/
/^GNULIB_PRINTF *=/s/@GNULIB_PRINTF@/0/
/^GNULIB_PRINTF_POSIX *=/s/@GNULIB_PRINTF_POSIX@/0/
+/^GNULIB_PSELECT *=/s/@GNULIB_PSELECT@/0/
/^GNULIB_PTHREAD_SIGMASK *=/s/@GNULIB_PTHREAD_SIGMASK@/0/
/^GNULIB_PTSNAME *=/s/@GNULIB_PTSNAME@/0/
/^GNULIB_PTSNAME_R *=/s/@GNULIB_PTSNAME_R@/0/
@@ -268,6 +270,7 @@ am__cd = cd
/^GNULIB_RMDIR *=/s/@GNULIB_RMDIR@/0/
/^GNULIB_RPMATCH *=/s/@GNULIB_RPMATCH@/0/
/^GNULIB_SCANF *=/s/@GNULIB_SCANF@/0/
+/^GNULIB_SELECT *=/s/@GNULIB_SELECT@/0/
/^GNULIB_SETENV *=/s/@GNULIB_SETENV@/0/
/^GNULIB_SETHOSTNAME *=/s/@GNULIB_SETHOSTNAME@/0/
/^GNULIB_SIGACTION *=/s/@GNULIB_SIGACTION@/0/
@@ -418,12 +421,15 @@ am__cd = cd
/^HAVE_STRTOULL *=/s/@HAVE_STRTOULL@/1/
/^HAVE_STRUCT_SIGACTION_SA_SIGACTION *=/s/@HAVE_STRUCT_SIGACTION_SA_SIGACTION@/0/
/^HAVE_STRUCT_RANDOM_DATA *=/s/@HAVE_STRUCT_RANDOM_DATA@/0/
+/^HAVE_STRUCT_TIMEVAL *=/s/@HAVE_STRUCT_TIMEVAL@/1/
/^HAVE_SYMLINK *=/s/@HAVE_SYMLINK@/1/
/^HAVE_SYMLINKAT *=/s/@HAVE_SYMLINKAT@/0/
/^HAVE_SYS_BITYPES_H *=/s/@HAVE_SYS_BITYPES_H@/0/
/^HAVE_SYS_INTTYPES_H *=/s/@HAVE_SYS_INTTYPES_H@/0/
/^HAVE_SYS_LOADAVG_H *=/s/@HAVE_SYS_LOADAVG_H@/0/
/^HAVE_SYS_PARAM_H *=/s/@HAVE_SYS_PARAM_H@/1/
+/^HAVE_SYS_SELECT_H *=/s/@HAVE_SYS_SELECT_H@/0/
+/^HAVE_SYS_TIME_H *=/s/@HAVE_SYS_TIME_H@/1/
/^HAVE_SYS_TYPES_H *=/s/@HAVE_SYS_TYPES_H@/1/
/^HAVE_TIMEGM *=/s/@HAVE_TIMEGM@/0/
/^HAVE_TYPE_VOLATILE_SIG_ATOMIC_T *=/s/@HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@/1/
@@ -457,7 +463,9 @@ am__cd = cd
/^NEXT_AS_FIRST_DIRECTIVE_STDINT_H *=/s/@[^@\n]*@//
/^NEXT_AS_FIRST_DIRECTIVE_STDIO_H *=/s/@[^@\n]*@//
/^NEXT_AS_FIRST_DIRECTIVE_STDLIB_H *=/s/@[^@\n]*@//
+/^NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H *=/s/@[^@\n]*@//
/^NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H *=/s!@[^@\n]*@!!
+/^NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H *=/s/@[^@\n]*@//
/^NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H *=/s!@[^@\n]*@!!
/^NEXT_AS_FIRST_DIRECTIVE_TIME_H *=/s/@[^@\n]*@//
/^NEXT_AS_FIRST_DIRECTIVE_UNISTD_H *=/s/@[^@\n]*@//
@@ -468,7 +476,9 @@ am__cd = cd
/^NEXT_STDIO_H *=/s/@[^@\n]*@//
/^NEXT_STDINT_H *=/s/@[^@\n]*@//
/^NEXT_STDLIB_H *=/s/@[^@\n]*@//
+/^NEXT_SYS_SELECT_H *=/s/@[^@\n]*@//
/^NEXT_SYS_STAT_H *=/s!@[^@\n]*@!!
+/^NEXT_SYS_TIME_H *=/s/@[^@\n]*@//
/^NEXT_SYS_TYPES_H *=/s!@[^@\n]*@!!
/^NEXT_TIME_H *=/s/@[^@\n]*@//
/^NEXT_UNISTD_H *=/s/@[^@\n]*@//
@@ -507,6 +517,7 @@ am__cd = cd
/^REPLACE_GETLINE *=/s/@REPLACE_GETLINE@/0/
/^REPLACE_GETLOGIN_R *=/s/@REPLACE_GETLOGIN_R@/0/
/^REPLACE_GETPAGESIZE *=/s/@REPLACE_GETPAGESIZE@/0/
+/^REPLACE_GETTIMEOFDAY *=/s/@REPLACE_GETTIMEOFDAY@/0/
/^REPLACE_ISATTY *=/s/@REPLACE_ISATTY@/0/
/^REPLACE_LCHOWN *=/s/@REPLACE_LCHOWN@/0/
/^REPLACE_LINK *=/s/@REPLACE_LINK@/0/
@@ -529,6 +540,7 @@ am__cd = cd
/^REPLACE_PREAD *=/s/@REPLACE_PREAD@/0/
/^REPLACE_PRINTF *=/s/@REPLACE_PRINTF@/0/
/^REPLACE_PTHREAD_SIGMASK *=/s/@REPLACE_PTHREAD_SIGMASK@/0/
+/^REPLACE_PSELECT *=/s/@REPLACE_PSELECT@/0/
/^REPLACE_PTSNAME_R *=/s/@REPLACE_PTSNAME_R@/0/
/^REPLACE_PUTENV *=/s/@REPLACE_PUTENV@/0/
/^REPLACE_PWRITE *=/s/@REPLACE_PWRITE@/0/
@@ -551,6 +563,7 @@ am__cd = cd
/^REPLACE_STDIO_WRITE_FUNCS *=/s/@REPLACE_STDIO_WRITE_FUNCS@/0/
/^REPLACE_STRTOD *=/s/@REPLACE_STRTOD@/0/
/^REPLACE_STRTOIMAX *=/s/@REPLACE_STRTOIMAX@/0/
+/^REPLACE_STRUCT_TIMEVAL *=/s/@REPLACE_STRUCT_TIMEVAL@/0/
/^REPLACE_SYMLINK *=/s/@REPLACE_SYMLINK@/0/
/^REPLACE_TIMEGM *=/s/@REPLACE_TIMEGM@/0/
/^REPLACE_TMPFILE *=/s/@REPLACE_TMPFILE@/0/
@@ -588,6 +601,10 @@ am__cd = cd
/am__append_2 *=.*verify\.h/s/@[^@\n]*@//
/^gl_LIBOBJS *=/s/@[^@\n]*@/getopt.o getopt1.o strftime.o time_r.o getloadavg.o pthread_sigmask.o/
/^BUILT_SOURCES *=/s/ *inttypes\.h//
+/^BUILT_SOURCES *=/,/^[^ ]/{
+ s| *sys/select\.h||
+ s| *sys/time\.h||
+}
/^am_libgnu_a_OBJECTS *=/s/careadlinkat\.\$(OBJEXT)//
/^am_libgnu_a_OBJECTS *=/s/allocator\.\$(OBJEXT)//
/^srcdir *=/s/@[^@\n]*@/./
@@ -661,3 +678,6 @@ s/\.in-h\; *\\$/.in-h >> $@-t/
s/'\; \\ *$/' >> $@-t/
}
s!\$(MKDIR_P)[ ][ ]*sys!command.com /c "if not exist sys\\stat.h md sys"!
+/^ @for dir in/,/^[^ ]/c\
+ -rm -rf $(MOSTLYCLEANDIRS)
+/^ *-test . /d
diff --git a/src/ChangeLog b/src/ChangeLog
index ce817c19894..9794c5ad4cd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,28 @@
+2012-06-30 Eli Zaretskii
+
+ * w32proc.c (sys_select): Accept and ignore one more argument.
+
+ * w32.c (emacs_gnutls_pull): Call select with one more argument.
+
+ * sysselect.h [DOS_NT]: Don't include sys/select.h.
+
+ * s/ms-w32.h (select, pselect): Don't define here, they are
+ defined in sysselect.h
+
+ * sysselect.h (pselect) [!HAVE_PSELECT]: Redirect to sys_select.
+
+ * sysdep.c: Don't include dos.h and dosfns.h.
+
+ * process.c (sys_select):
+ * msdos.c (sys_select): Accept one more argument and ignore it.
+
+ * msdos.c (event_timestamp, sys_select): Use gnulib's gettime;
+ adapt data types and code to that.
+
+ * dosfns.c:
+ * msdos.c (gettime, settime): Define away the prototypes in dos.h,
+ which clashes with the gnulib function of the same name.
+
2012-06-30 Andreas Schwab
* font.c (font_style_to_value, font_style_symbolic)
diff --git a/src/dosfns.c b/src/dosfns.c
index 11d2258f614..0561a941162 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -23,7 +23,13 @@ along with GNU Emacs. If not, see . */
/* The entire file is within this conditional */
#include
+/* gettine and settime in dos.h clash with their namesakes from
+ gnulib, so we move out of our way the prototypes in dos.h. */
+#define gettime dos_h_gettime_
+#define settime dos_h_settime_
#include
+#undef gettime
+#undef settime
#include
#include "lisp.h"
#include "character.h"
diff --git a/src/msdos.c b/src/msdos.c
index a79fad0ccd4..4dec901988b 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -31,7 +31,13 @@ along with GNU Emacs. If not, see . */
#include
#include
#include
+/* gettine and settime in dos.h clash with their namesakes from
+ gnulib, so we move out of our way the prototypes in dos.h. */
+#define gettime dos_h_gettime_
+#define settime dos_h_settime_
#include
+#undef gettime
+#undef settime
#include
#include /* for _fixpath */
#include /* for chdir, dup, dup2, etc. */
@@ -103,18 +109,18 @@ int _crt0_startup_flags = (_CRT0_FLAG_UNIX_SBRK | _CRT0_FLAG_FILL_SBRK_MEMORY);
#endif /* not SYSTEM_MALLOC */
+/* Return the current timestamp in milliseconds since midnight. */
static unsigned long
event_timestamp (void)
{
- struct time t;
+ struct timespec t;
unsigned long s;
gettime (&t);
- s = t.ti_min;
- s *= 60;
- s += t.ti_sec;
+ s = t.tv_sec;
+ s %= 86400;
s *= 1000;
- s += t.ti_hund * 10;
+ s += t.tv_nsec * 1000000;
return s;
}
@@ -4097,10 +4103,10 @@ dos_yield_time_slice (void)
because wait_reading_process_output takes care of that. */
int
sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
- EMACS_TIME *timeout)
+ EMACS_TIME *timeout, void *ignored)
{
int check_input;
- struct time t;
+ struct timespec t;
check_input = 0;
if (rfds)
@@ -4130,18 +4136,13 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
EMACS_TIME clnow, cllast, cldiff;
gettime (&t);
- EMACS_SET_SECS_USECS (cllast, t.ti_sec, t.ti_hund * 10000L);
+ EMACS_SET_SECS_NSECS (cllast, t.tv_sec, t.tv_nsec);
while (!check_input || !detect_input_pending ())
{
gettime (&t);
- EMACS_SET_SECS_USECS (clnow, t.ti_sec, t.ti_hund * 10000L);
+ EMACS_SET_SECS_NSECS (clnow, t.tv_sec, t.tv_nsec);
EMACS_SUB_TIME (cldiff, clnow, cllast);
-
- /* When seconds wrap around, we assume that no more than
- 1 minute passed since last `gettime'. */
- if (EMACS_TIME_SIGN (cldiff) < 0)
- EMACS_SET_SECS (cldiff, EMACS_SECS (cldiff) + 60);
EMACS_SUB_TIME (*timeout, *timeout, cldiff);
/* Stop when timeout value crosses zero. */
diff --git a/src/process.c b/src/process.c
index e9ad3b10c33..fa16c178c16 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6808,7 +6808,7 @@ keyboard_bit_set (fd_set *mask)
/* Defined on msdos.c. */
extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
- EMACS_TIME *);
+ EMACS_TIME *, void *);
/* Implementation of wait_reading_process_output, assuming that there
are no subprocesses. Used only by the MS-DOS build.
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 38e368e5bd2..3a95bffadb8 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -234,7 +234,7 @@ struct sigaction {
#define rename sys_rename
#define rmdir sys_rmdir
#define select sys_select
-#define pselect sys_select
+#define pselect sys_select
#define sleep sys_sleep
#define strerror sys_strerror
#undef unlink
diff --git a/src/sysdep.c b/src/sysdep.c
index 089b7ba5c8e..29e396c914d 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -65,8 +65,6 @@ along with GNU Emacs. If not, see . */
#endif
#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
-#include
-#include "dosfns.h"
#include "msdos.h"
#include
#endif
diff --git a/src/sysselect.h b/src/sysselect.h
index 328372d427c..2dbbede2bff 100644
--- a/src/sysselect.h
+++ b/src/sysselect.h
@@ -19,7 +19,7 @@ along with GNU Emacs. If not, see . */
#if defined (DARWIN_OS)
#undef init_process
#endif
-#ifndef WINDOWSNT
+#ifndef DOS_NT
#include
#endif
#if defined (DARWIN_OS)
@@ -52,3 +52,7 @@ along with GNU Emacs. If not, see . */
#if !defined (HAVE_SELECT)
#define select sys_select
#endif
+
+#ifdef MSDOS
+#define pselect sys_select
+#endif
diff --git a/src/w32.c b/src/w32.c
index 691d80a6313..9f57a8d0e79 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -6312,7 +6312,7 @@ emacs_gnutls_pull (gnutls_transport_ptr_t p, void* buf, size_t sz)
/* Use select with the timeout to poll the selector. */
sc = select (fd + 1, &fdset, (SELECT_TYPE *)0, (SELECT_TYPE *)0,
- &timeout);
+ &timeout, NULL);
if (sc > 0)
continue; /* Try again. */
diff --git a/src/w32proc.c b/src/w32proc.c
index 3864d15623a..afc1b21fdde 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1080,7 +1080,7 @@ extern int proc_buffered_char[];
int
sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
- EMACS_TIME *timeout)
+ EMACS_TIME *timeout, void *ignored)
{
SELECT_TYPE orfds;
DWORD timeout_ms, start_time;