aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <[email protected]>2012-06-30 18:55:27 +0300
committerEli Zaretskii <[email protected]>2012-06-30 18:55:27 +0300
commitc9240d7a6eb3d8aaca76cd3abc8f099b6ecaff0a (patch)
treec230c2d0e84580f38fe44803b46e149e4149b739 /src
parentb3218de111201a7b19592f4176057b03749d55a0 (diff)
parent0d23c240ea378d9a29042266216f4cf25151a04d (diff)
Adapt the MS-DOS build to the latest changes.
msdos/mainmake.v2 (bootstrap-clean): Do a maintainer-clean in lib, not bootstrap-clean (which doesn't exist). msdos/inttypes.h (PRIuMAX) [__DJGPP__ < 2.04]: Define to "llu". msdos/sedleim.inp (MKDIR_P): Edit to DOS "md" command. msdos/sed1v2.inp: (LIB_CLOCK_GETTIME): Edit to empty. Remove lines that invoke PAXCTL. (clean): Fix recipe not to run Unixy shell commands. msdos/sed2v2.inp (GETTIMEOFDAY_TIMEZONE): Edit to 'struct timezone'. (HAVE_STRNCASECMP): Edit to 1. msdos/sed3v2.inp (LIB_CLOCK_GETTIME): Edit to empty. (C_SWITCH_SYSTEM): Add "-I../msdos". 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. src/sysselect.h [DOS_NT]: Don't include sys/select.h. src/sysselect.h (pselect) [!HAVE_PSELECT]: Redirect to sys_select. src/sysdep.c: Don't include dos.h and dosfns.h. src/process.c (sys_select): src/msdos.c (sys_select): Accept one more argument and ignore it. src/msdos.c (event_timestamp, sys_select): Use gnulib's gettime; adapt data types and code to that. src/dosfns.c: src/msdos.c (gettime, settime): Define away the prototypes in dos.h, which clashes with the gnulib function of the same name. src/ w32proc.c (sys_select): Accept and ignore one more argument. src/w32.c (emacs_gnutls_pull): Call select with one more argument. lisp/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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog25
-rw-r--r--src/dosfns.c6
-rw-r--r--src/msdos.c29
-rw-r--r--src/process.c2
-rw-r--r--src/s/ms-w32.h2
-rw-r--r--src/sysdep.c2
-rw-r--r--src/sysselect.h6
-rw-r--r--src/w32.c2
-rw-r--r--src/w32proc.c2
9 files changed, 55 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ce817c1989..9794c5ad4c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,28 @@
+2012-06-30 Eli Zaretskii <[email protected]>
+
+ * 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 <[email protected]>
* font.c (font_style_to_value, font_style_symbolic)
diff --git a/src/dosfns.c b/src/dosfns.c
index 11d2258f61..0561a94116 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -23,7 +23,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* The entire file is within this conditional */
#include <stdio.h>
+/* 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 <dos.h>
+#undef gettime
+#undef settime
#include <setjmp.h>
#include "lisp.h"
#include "character.h"
diff --git a/src/msdos.c b/src/msdos.c
index a79fad0ccd..4dec901988 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -31,7 +31,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <time.h>
#include <sys/param.h>
#include <sys/time.h>
+/* 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 <dos.h>
+#undef gettime
+#undef settime
#include <errno.h>
#include <sys/stat.h> /* for _fixpath */
#include <unistd.h> /* 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 e9ad3b10c3..fa16c178c1 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 38e368e5bd..3a95bffadb 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 089b7ba5c8..29e396c914 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -65,8 +65,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif
#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
-#include <dos.h>
-#include "dosfns.h"
#include "msdos.h"
#include <sys/param.h>
#endif
diff --git a/src/sysselect.h b/src/sysselect.h
index 328372d427..2dbbede2bf 100644
--- a/src/sysselect.h
+++ b/src/sysselect.h
@@ -19,7 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#if defined (DARWIN_OS)
#undef init_process
#endif
-#ifndef WINDOWSNT
+#ifndef DOS_NT
#include <sys/select.h>
#endif
#if defined (DARWIN_OS)
@@ -52,3 +52,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#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 691d80a631..9f57a8d0e7 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 3864d15623..afc1b21fdd 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;