]> code.delx.au - gnu-emacs/commitdiff
Fix the MS-Windows build broken by 2012-06-22T21:17:42Z!eggert@cs.ucla.edu.
authorEli Zaretskii <eliz@gnu.org>
Sat, 23 Jun 2012 10:22:59 +0000 (13:22 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 23 Jun 2012 10:22:59 +0000 (13:22 +0300)
 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
12 files changed:
ChangeLog
lib/makefile.w32-in
lib/stat-time.h
lib/timespec.h
lib/utimens.h
nt/ChangeLog
nt/inc/sys/time.h
src/ChangeLog
src/s/ms-w32.h
src/sysselect.h
src/w32.c
src/w32proc.c

index 21072dd6a797588ac3f6d0ec77135a640d2cbc42..103af723a3469717ace30af6eb4d850b20956e69 100644 (file)
--- 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
index 62808f73a746a1903162d49e3a2e0608cd8c6504..35745f647b2a1038eb823ee5ea0327c2d10ad765 100644 (file)
@@ -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 \
index 30c2acdab63637b73c590bfb91e06502839bcf94..03d49977945f76d254ae55a199f5bc7115c729dd 100644 (file)
@@ -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,
index 388ddb83a76120814003276f18966a4f7a904faf..51b85d050daf534fd5acd542c6d6542a6ab6e13f 100644 (file)
@@ -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.
 
index 8c47cf93f887dc05a2e84eb3349d61d91da22177..dfcbae1909d81c8fa198b592c14c4726bead823d 100644 (file)
@@ -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]);
index cc5fda97755b48212f0c3576ed1005b5282ba0c8..11109da92f2be57191a933c4cd7f042f0ab5d196 100644 (file)
@@ -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.
index c90d1fd62f542fe98e26b8a93f25f3ef93936a07..583b966b760a2bfe6f73e4d09fc2332746740115 100644 (file)
@@ -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 *);
 
index 557a844c8f1c44c362700c5327cf322ffdaad72c..27101506fa8e2341ca460c9e0fa17f9827323fbf 100644 (file)
@@ -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.
index 5bf71d5f3217d694ebe0c0fc9bcfb1a1908dbfb2..a26530bab64811420fece610b417106485110293 100644 (file)
@@ -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
index e1e5839cfe4e2071499bcca9e05e5d72e89ceb55..328372d427c5cd7a51ecb5b155f28df0ebe2f307 100644 (file)
@@ -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
index dbe7ec1764f858e56cd9c78fb81715d036df1497..5a36a43302e0dd7577bf3738abce8270a7c4b46d 100644 (file)
--- 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. */
 /* ------------------------------------------------------------------------- */
index 5bdeba259587ff35847a7a84dd62394a25fbc5c5..55b9ee1ec0e6d89c8716dad328538a8f62b4df06 100644 (file)
@@ -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)