diff options
author | Eli Zaretskii <eliz@gnu.org> | 2012-06-23 13:22:59 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2012-06-23 13:22:59 +0300 |
commit | 388cdec072a52e1b647dec159433fd0ffe240be4 (patch) | |
tree | efd6a04f97a631114fd093b4414a9242486e04a5 | |
parent | f199cab1a97da8c46b719bb73af58acdcb6243c1 (diff) | |
download | emacs-388cdec072a52e1b647dec159433fd0ffe240be4.tar.gz |
Fix the MS-Windows build broken by 2012-06-22T21:17:42Z!eggert@cs.ucla.edu.
nt/inc/sys/time.h (struct timespec): Define.
lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/dtotimespec.$(O),
$(BLD)/gettime.$(O), $(BLD)/timespec-add.$(O), and
$(BLD)/timespec-sub.$(O).
($(BLD)/dtotimespec.$(O)):
($(BLD)/gettime.$(O)):
($(BLD)/timespec-add.$(O)):
($(BLD)/timespec-sub.$(O)): New dependencies.
lib/stat-time.h:
lib/timespec.h:
lib/utimens.h: Include sys/time.h
src/w32.c (fdutimens): New function.
src/w32proc.c (sys_select): Adapt to change in the EMACS_TIME type.
src/s/ms-w32.h (pselect): Redirect to sys_select.
src/sysselect.h [WINDOWSNT]: Don't include sys/select.h.
Fixes: debbugs:9000
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | lib/makefile.w32-in | 39 | ||||
-rw-r--r-- | lib/stat-time.h | 1 | ||||
-rw-r--r-- | lib/timespec.h | 1 | ||||
-rw-r--r-- | lib/utimens.h | 1 | ||||
-rw-r--r-- | nt/ChangeLog | 5 | ||||
-rw-r--r-- | nt/inc/sys/time.h | 23 | ||||
-rw-r--r-- | src/ChangeLog | 9 | ||||
-rw-r--r-- | src/s/ms-w32.h | 1 | ||||
-rw-r--r-- | src/sysselect.h | 2 | ||||
-rw-r--r-- | src/w32.c | 35 | ||||
-rw-r--r-- | src/w32proc.c | 3 |
12 files changed, 126 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog index 21072dd6a79..103af723a34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2012-06-23 Eli Zaretskii <eliz@gnu.org> + + Fix the MS-Windows build broken by 2012-06-22T21:17:42Z!eggert@cs.ucla.edu. + * lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/dtotimespec.$(O), + $(BLD)/gettime.$(O), $(BLD)/timespec-add.$(O), and + $(BLD)/timespec-sub.$(O). + ($(BLD)/dtotimespec.$(O)): + ($(BLD)/gettime.$(O)): + ($(BLD)/timespec-add.$(O)): + ($(BLD)/timespec-sub.$(O)): New dependencies. + + * lib/stat-time.h: + * lib/timespec.h: + * lib/utimens.h: Include sys/time.h + 2012-06-23 Andreas Schwab <schwab@linux-m68k.org> * configure.in: Don't use AC_CHECK_FUNCS_ONCE, which doesn't use diff --git a/lib/makefile.w32-in b/lib/makefile.w32-in index 62808f73a74..35745f647b2 100644 --- a/lib/makefile.w32-in +++ b/lib/makefile.w32-in @@ -24,10 +24,14 @@ LOCAL_FLAGS = -DHAVE_CONFIG_H=1 -I. -I../nt/inc -I../src LIBS = GNULIBOBJS = $(BLD)/dtoastr.$(O) \ + $(BLD)/dtotimespec.$(O) \ $(BLD)/getopt.$(O) \ $(BLD)/getopt1.$(O) \ + $(BLD)/gettime.$(O) \ $(BLD)/strftime.$(O) \ $(BLD)/time_r.$(O) \ + $(BLD)/timespec-add.$(O) \ + $(BLD)/timespec-sub.$(O) \ $(BLD)/md5.$(O) \ $(BLD)/sha1.$(O) \ $(BLD)/sha256.$(O) \ @@ -69,6 +73,15 @@ $(BLD)/dtoastr.$(O) : \ $(EMACS_ROOT)/src/s/ms-w32.h \ $(EMACS_ROOT)/src/config.h +$(BLD)/dtotimespec.$(O) : \ + $(SRC)/dtotimespec.c \ + $(SRC)/intprops.h \ + $(SRC)/timespec.h \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ + $(EMACS_ROOT)/nt/inc/sys/stat.h \ + $(EMACS_ROOT)/src/s/ms-w32.h \ + $(EMACS_ROOT)/src/config.h + $(BLD)/getopt.$(O) : \ $(SRC)/getopt.c \ $(SRC)/getopt.h \ @@ -87,6 +100,14 @@ $(BLD)/getopt1.$(O) : \ $(EMACS_ROOT)/src/s/ms-w32.h \ $(EMACS_ROOT)/src/config.h +$(BLD)/gettime.$(O) : \ + $(SRC)/gettime.c \ + $(SRC)/timespec.h \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ + $(EMACS_ROOT)/nt/inc/sys/stat.h \ + $(EMACS_ROOT)/src/s/ms-w32.h \ + $(EMACS_ROOT)/src/config.h + $(BLD)/strftime.$(O) : \ $(SRC)/strftime.c \ $(SRC)/strftime.h \ @@ -101,6 +122,24 @@ $(BLD)/time_r.$(O) : \ $(EMACS_ROOT)/src/s/ms-w32.h \ $(EMACS_ROOT)/src/config.h +$(BLD)/timespec-add.$(O) : \ + $(SRC)/timespec-add.c \ + $(SRC)/intprops.h \ + $(SRC)/timespec.h \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ + $(EMACS_ROOT)/nt/inc/sys/stat.h \ + $(EMACS_ROOT)/src/s/ms-w32.h \ + $(EMACS_ROOT)/src/config.h + +$(BLD)/timespec-sub.$(O) : \ + $(SRC)/timespec-sub.c \ + $(SRC)/intprops.h \ + $(SRC)/timespec.h \ + $(EMACS_ROOT)/nt/inc/sys/time.h \ + $(EMACS_ROOT)/nt/inc/sys/stat.h \ + $(EMACS_ROOT)/src/s/ms-w32.h \ + $(EMACS_ROOT)/src/config.h + $(BLD)/md5.$(O) : \ $(SRC)/md5.c \ $(SRC)/md5.h \ diff --git a/lib/stat-time.h b/lib/stat-time.h index 30c2acdab63..03d49977945 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -22,6 +22,7 @@ #include <sys/stat.h> #include <time.h> +#include <sys/time.h> /* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST, diff --git a/lib/timespec.h b/lib/timespec.h index 388ddb83a76..51b85d050da 100644 --- a/lib/timespec.h +++ b/lib/timespec.h @@ -20,6 +20,7 @@ # define TIMESPEC_H # include <time.h> +# include <sys/time.h> /* Return negative, zero, positive if A < B, A == B, A > B, respectively. diff --git a/lib/utimens.h b/lib/utimens.h index 8c47cf93f88..dfcbae1909d 100644 --- a/lib/utimens.h +++ b/lib/utimens.h @@ -1,4 +1,5 @@ #include <time.h> +#include <sys/time.h> int fdutimens (int, char const *, struct timespec const [2]); int utimens (char const *, struct timespec const [2]); int lutimens (char const *, struct timespec const [2]); diff --git a/nt/ChangeLog b/nt/ChangeLog index cc5fda97755..11109da92f2 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,8 @@ +2012-06-23 Eli Zaretskii <eliz@gnu.org> + + Fix the MS-Windows build broken by 2012-06-22T21:17:42Z!eggert@cs.ucla.edu. + * inc/sys/time.h (struct timespec): Define. + 2012-06-16 Eli Zaretskii <eliz@gnu.org> * makefile.w32-in (install-addpm): New target. diff --git a/nt/inc/sys/time.h b/nt/inc/sys/time.h index c90d1fd62f5..583b966b760 100644 --- a/nt/inc/sys/time.h +++ b/nt/inc/sys/time.h @@ -6,15 +6,22 @@ */ struct timeval - { - long tv_sec; /* seconds */ - long tv_usec; /* microseconds */ - }; +{ + long tv_sec; /* seconds */ + long tv_usec; /* microseconds */ +}; + struct timezone - { - int tz_minuteswest; /* minutes west of Greenwich */ - int tz_dsttime; /* type of dst correction */ - }; +{ + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +struct timespec +{ + time_t tv_sec; /* seconds */ + long int tv_nsec; /* nanoseconds */ +}; void gettimeofday (struct timeval *, struct timezone *); diff --git a/src/ChangeLog b/src/ChangeLog index 557a844c8f1..27101506fa8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,14 @@ 2012-06-23 Eli Zaretskii <eliz@gnu.org> + Fix the MS-Windows build broken by 2012-06-22T21:17:42Z!eggert@cs.ucla.edu. + * w32.c (fdutimens): New function. + + * w32proc.c (sys_select): Adapt to change in the EMACS_TIME type. + + * s/ms-w32.h (pselect): Redirect to sys_select. + + * sysselect.h [WINDOWSNT]: Don't include sys/select.h. + * ralloc.c (r_alloc_inhibit_buffer_relocation): Fix stupid thinko in the logic of incrementing and decrementing the value of use_relocatable_buffers. diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h index 5bf71d5f321..a26530bab64 100644 --- a/src/s/ms-w32.h +++ b/src/s/ms-w32.h @@ -226,6 +226,7 @@ struct sigaction { #define rename sys_rename #define rmdir sys_rmdir #define select sys_select +#define pselect sys_select #define sleep sys_sleep #define strerror sys_strerror #undef unlink diff --git a/src/sysselect.h b/src/sysselect.h index e1e5839cfe4..328372d427c 100644 --- a/src/sysselect.h +++ b/src/sysselect.h @@ -19,7 +19,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #if defined (DARWIN_OS) #undef init_process #endif +#ifndef WINDOWSNT #include <sys/select.h> +#endif #if defined (DARWIN_OS) #define init_process emacs_init_process #endif diff --git a/src/w32.c b/src/w32.c index dbe7ec1764f..5a36a43302e 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1996,6 +1996,41 @@ gettimeofday (struct timeval *tv, struct timezone *tz) } } +/* Emulate fdutimens. */ + +/* Set the access and modification time stamps of FD (a.k.a. FILE) to be + TIMESPEC[0] and TIMESPEC[1], respectively. + FD must be either negative -- in which case it is ignored -- + or a file descriptor that is open on FILE. + If FD is nonnegative, then FILE can be NULL, which means + use just futimes instead of utimes. + If TIMESPEC is null, FAIL. + Return 0 on success, -1 (setting errno) on failure. */ + +int +fdutimens (int fd, char const *file, struct timespec const timespec[2]) +{ + struct _utimbuf ut; + + if (!timespec) + { + errno = ENOSYS; + return -1; + } + if (fd < 0 && !file) + { + errno = EBADF; + return -1; + } + ut.actime = timespec[0].tv_sec; + ut.modtime = timespec[1].tv_sec; + if (fd >= 0) + return _futime (fd, &ut); + else + return _utime (file, &ut); +} + + /* ------------------------------------------------------------------------- */ /* IO support and wrapper functions for W32 API. */ /* ------------------------------------------------------------------------- */ diff --git a/src/w32proc.c b/src/w32proc.c index 5bdeba25958..55b9ee1ec0e 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -1090,7 +1090,8 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, HANDLE wait_hnd[MAXDESC + MAX_CHILDREN]; int fdindex[MAXDESC]; /* mapping from wait handles back to descriptors */ - timeout_ms = timeout ? (timeout->tv_sec * 1000 + timeout->tv_usec / 1000) : INFINITE; + timeout_ms = + timeout ? (timeout->tv_sec * 1000 + timeout->tv_nsec / 1000000) : INFINITE; /* If the descriptor sets are NULL but timeout isn't, then just Sleep. */ if (rfds == NULL && wfds == NULL && efds == NULL && timeout != NULL) |