diff options
| author | Eli Zaretskii | 2012-06-30 18:55:27 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2012-06-30 18:55:27 +0300 |
| commit | c9240d7a6eb3d8aaca76cd3abc8f099b6ecaff0a (patch) | |
| tree | c230c2d0e84580f38fe44803b46e149e4149b739 /src/msdos.c | |
| parent | b3218de111201a7b19592f4176057b03749d55a0 (diff) | |
| parent | 0d23c240ea378d9a29042266216f4cf25151a04d (diff) | |
| download | emacs-c9240d7a6eb3d8aaca76cd3abc8f099b6ecaff0a.tar.gz emacs-c9240d7a6eb3d8aaca76cd3abc8f099b6ecaff0a.zip | |
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/msdos.c')
| -rw-r--r-- | src/msdos.c | 29 |
1 files changed, 15 insertions, 14 deletions
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 <http://www.gnu.org/licenses/>. */ | |||
| 31 | #include <time.h> | 31 | #include <time.h> |
| 32 | #include <sys/param.h> | 32 | #include <sys/param.h> |
| 33 | #include <sys/time.h> | 33 | #include <sys/time.h> |
| 34 | /* gettine and settime in dos.h clash with their namesakes from | ||
| 35 | gnulib, so we move out of our way the prototypes in dos.h. */ | ||
| 36 | #define gettime dos_h_gettime_ | ||
| 37 | #define settime dos_h_settime_ | ||
| 34 | #include <dos.h> | 38 | #include <dos.h> |
| 39 | #undef gettime | ||
| 40 | #undef settime | ||
| 35 | #include <errno.h> | 41 | #include <errno.h> |
| 36 | #include <sys/stat.h> /* for _fixpath */ | 42 | #include <sys/stat.h> /* for _fixpath */ |
| 37 | #include <unistd.h> /* for chdir, dup, dup2, etc. */ | 43 | #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); | |||
| 103 | 109 | ||
| 104 | #endif /* not SYSTEM_MALLOC */ | 110 | #endif /* not SYSTEM_MALLOC */ |
| 105 | 111 | ||
| 112 | /* Return the current timestamp in milliseconds since midnight. */ | ||
| 106 | static unsigned long | 113 | static unsigned long |
| 107 | event_timestamp (void) | 114 | event_timestamp (void) |
| 108 | { | 115 | { |
| 109 | struct time t; | 116 | struct timespec t; |
| 110 | unsigned long s; | 117 | unsigned long s; |
| 111 | 118 | ||
| 112 | gettime (&t); | 119 | gettime (&t); |
| 113 | s = t.ti_min; | 120 | s = t.tv_sec; |
| 114 | s *= 60; | 121 | s %= 86400; |
| 115 | s += t.ti_sec; | ||
| 116 | s *= 1000; | 122 | s *= 1000; |
| 117 | s += t.ti_hund * 10; | 123 | s += t.tv_nsec * 1000000; |
| 118 | 124 | ||
| 119 | return s; | 125 | return s; |
| 120 | } | 126 | } |
| @@ -4097,10 +4103,10 @@ dos_yield_time_slice (void) | |||
| 4097 | because wait_reading_process_output takes care of that. */ | 4103 | because wait_reading_process_output takes care of that. */ |
| 4098 | int | 4104 | int |
| 4099 | sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, | 4105 | sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, |
| 4100 | EMACS_TIME *timeout) | 4106 | EMACS_TIME *timeout, void *ignored) |
| 4101 | { | 4107 | { |
| 4102 | int check_input; | 4108 | int check_input; |
| 4103 | struct time t; | 4109 | struct timespec t; |
| 4104 | 4110 | ||
| 4105 | check_input = 0; | 4111 | check_input = 0; |
| 4106 | if (rfds) | 4112 | if (rfds) |
| @@ -4130,18 +4136,13 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, | |||
| 4130 | EMACS_TIME clnow, cllast, cldiff; | 4136 | EMACS_TIME clnow, cllast, cldiff; |
| 4131 | 4137 | ||
| 4132 | gettime (&t); | 4138 | gettime (&t); |
| 4133 | EMACS_SET_SECS_USECS (cllast, t.ti_sec, t.ti_hund * 10000L); | 4139 | EMACS_SET_SECS_NSECS (cllast, t.tv_sec, t.tv_nsec); |
| 4134 | 4140 | ||
| 4135 | while (!check_input || !detect_input_pending ()) | 4141 | while (!check_input || !detect_input_pending ()) |
| 4136 | { | 4142 | { |
| 4137 | gettime (&t); | 4143 | gettime (&t); |
| 4138 | EMACS_SET_SECS_USECS (clnow, t.ti_sec, t.ti_hund * 10000L); | 4144 | EMACS_SET_SECS_NSECS (clnow, t.tv_sec, t.tv_nsec); |
| 4139 | EMACS_SUB_TIME (cldiff, clnow, cllast); | 4145 | EMACS_SUB_TIME (cldiff, clnow, cllast); |
| 4140 | |||
| 4141 | /* When seconds wrap around, we assume that no more than | ||
| 4142 | 1 minute passed since last `gettime'. */ | ||
| 4143 | if (EMACS_TIME_SIGN (cldiff) < 0) | ||
| 4144 | EMACS_SET_SECS (cldiff, EMACS_SECS (cldiff) + 60); | ||
| 4145 | EMACS_SUB_TIME (*timeout, *timeout, cldiff); | 4146 | EMACS_SUB_TIME (*timeout, *timeout, cldiff); |
| 4146 | 4147 | ||
| 4147 | /* Stop when timeout value crosses zero. */ | 4148 | /* Stop when timeout value crosses zero. */ |