deps: upgrade libuv to 7841f77
authorBen Noordhuis <info@bnoordhuis.nl>
Tue, 22 Jan 2013 15:21:25 +0000 (16:21 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Tue, 22 Jan 2013 15:21:25 +0000 (16:21 +0100)
deps/uv/README.md
deps/uv/src/unix/fs.c
deps/uv/src/unix/linux/syscalls.c
deps/uv/src/unix/linux/syscalls.h
deps/uv/src/unix/udp.c
deps/uv/src/uv-common.c
deps/uv/src/win/udp.c
deps/uv/test/test-tcp-bind-error.c
deps/uv/test/test-tcp-bind6-error.c
deps/uv/test/test-threadpool-cancel.c
deps/uv/uv.gyp

index 2d8b436..e37b962 100644 (file)
@@ -56,7 +56,7 @@ http://nodejs.org/
 For GCC (including MinGW) there are two methods building: via normal
 makefiles or via GYP. GYP is a meta-build system which can generate MSVS,
 Makefile, and XCode backends. It is best used for integration into other
-projects.  The old (more stable) system is using Makefiles.
+projects.  The old system is using plain GNU Makefiles.
 
 To build via Makefile simply execute:
 
@@ -69,15 +69,22 @@ related files.
 Windows users can also build from cmd-line using msbuild.  This is
 done by running vcbuild.bat from Visual Studio command prompt.
 
-To have GYP generate build script for another system you will need to
-checkout GYP into the project tree manually:
+To have GYP generate build script for another system, make sure that
+you have Python 2.6 or 2.7 installed, then checkout GYP into the
+project tree manually:
 
+    mkdir -p build
     svn co http://gyp.googlecode.com/svn/trunk build/gyp
 
+Or:
+
+    mkdir -p build
+    git clone https://git.chromium.org/external/gyp.git build/gyp
+
 Unix users run
 
     ./gyp_uv -f make
-    make
+    make -C out
 
 Macintosh users run
 
index f01c83b..6b7ac6c 100644 (file)
@@ -113,12 +113,55 @@ static ssize_t uv__fs_futime(uv_fs_t* req) {
   /* utimesat() has nanosecond resolution but we stick to microseconds
    * for the sake of consistency with other platforms.
    */
+  static int no_utimesat;
   struct timespec ts[2];
+  struct timeval tv[2];
+  char path[sizeof("/proc/self/fd/") + 3 * sizeof(int)];
+  int r;
+
+  if (no_utimesat)
+    goto skip;
+
   ts[0].tv_sec  = req->atime;
   ts[0].tv_nsec = (unsigned long)(req->atime * 1000000) % 1000000 * 1000;
   ts[1].tv_sec  = req->mtime;
   ts[1].tv_nsec = (unsigned long)(req->mtime * 1000000) % 1000000 * 1000;
-  return uv__utimesat(req->file, NULL, ts, 0);
+
+  r = uv__utimesat(req->file, NULL, ts, 0);
+  if (r == 0)
+    return r;
+
+  if (errno != ENOSYS)
+    return r;
+
+  no_utimesat = 1;
+
+skip:
+
+  tv[0].tv_sec  = req->atime;
+  tv[0].tv_usec = (unsigned long)(req->atime * 1000000) % 1000000;
+  tv[1].tv_sec  = req->mtime;
+  tv[1].tv_usec = (unsigned long)(req->mtime * 1000000) % 1000000;
+  snprintf(path, sizeof(path), "/proc/self/fd/%d", (int) req->file);
+
+  r = utimes(path, tv);
+  if (r == 0)
+    return r;
+
+  switch (errno) {
+  case ENOENT:
+    if (fcntl(req->file, F_GETFL) == -1 && errno == EBADF)
+      break;
+    /* Fall through. */
+
+  case EACCES:
+  case ENOTDIR:
+    errno = ENOSYS;
+    break;
+  }
+
+  return r;
+
 #elif defined(__APPLE__)                                                      \
     || defined(__DragonFly__)                                                 \
     || defined(__FreeBSD__)                                                   \
index 1f0174a..870763b 100644 (file)
@@ -323,7 +323,7 @@ int uv__inotify_init1(int flags) {
 }
 
 
-int uv__inotify_add_watch(int fd, const char* path, __u32 mask) {
+int uv__inotify_add_watch(int fd, const char* path, uint32_t mask) {
 #if defined(__NR_inotify_add_watch)
   return syscall(__NR_inotify_add_watch, fd, path, mask);
 #else
@@ -332,7 +332,7 @@ int uv__inotify_add_watch(int fd, const char* path, __u32 mask) {
 }
 
 
-int uv__inotify_rm_watch(int fd, __s32 wd) {
+int uv__inotify_rm_watch(int fd, int32_t wd) {
 #if defined(__NR_inotify_rm_watch)
   return syscall(__NR_inotify_rm_watch, fd, wd);
 #else
index e65eb45..195a981 100644 (file)
 #undef  _GNU_SOURCE
 #define _GNU_SOURCE
 
+#include <stdint.h>
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <linux/types.h>
 
 #define UV__O_NONBLOCK        0x800
 #define UV__O_CLOEXEC         0x80000
 
 #if defined(__x86_64__)
 struct uv__epoll_event {
-  __u32 events;
-  __u64 data;
+  uint32_t events;
+  uint64_t data;
 } __attribute__((packed));
 #else
 struct uv__epoll_event {
-  __u32 events;
-  __u64 data;
+  uint32_t events;
+  uint64_t data;
 };
 #endif
 
 struct uv__inotify_event {
-  __s32 wd;
-  __u32 mask;
-  __u32 cookie;
-  __u32 len;
+  int32_t wd;
+  uint32_t mask;
+  uint32_t cookie;
+  uint32_t len;
   /* char name[0]; */
 };
 
@@ -111,8 +111,8 @@ int uv__epoll_pwait(int epfd,
 int uv__eventfd2(unsigned int count, int flags);
 int uv__inotify_init(void);
 int uv__inotify_init1(int flags);
-int uv__inotify_add_watch(int fd, const char* path, __u32 mask);
-int uv__inotify_rm_watch(int fd, __s32 wd);
+int uv__inotify_add_watch(int fd, const char* path, uint32_t mask);
+int uv__inotify_rm_watch(int fd, int32_t wd);
 int uv__pipe2(int pipefd[2], int flags);
 int uv__recvmmsg(int fd,
                  struct uv__mmsghdr* mmsg,
index f79b09c..8388ba6 100644 (file)
@@ -542,8 +542,7 @@ int uv_udp_set_membership(uv_udp_t* handle, const char* multicast_addr,
     optname = IP_DROP_MEMBERSHIP;
     break;
   default:
-    uv__set_sys_error(handle->loop, EFAULT);
-    return -1;
+    return uv__set_artificial_error(handle->loop, UV_EINVAL);
   }
 
   if (setsockopt(handle->io_watcher.fd, IPPROTO_IP, optname, (void*) &mreq, sizeof mreq) == -1) {
index dd91dbb..0b05334 100644 (file)
@@ -198,7 +198,7 @@ int uv_ip6_name(struct sockaddr_in6* src, char* dst, size_t size) {
 
 int uv_tcp_bind(uv_tcp_t* handle, struct sockaddr_in addr) {
   if (handle->type != UV_TCP || addr.sin_family != AF_INET) {
-    uv__set_artificial_error(handle->loop, UV_EFAULT);
+    uv__set_artificial_error(handle->loop, UV_EINVAL);
     return -1;
   }
 
@@ -208,7 +208,7 @@ int uv_tcp_bind(uv_tcp_t* handle, struct sockaddr_in addr) {
 
 int uv_tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6 addr) {
   if (handle->type != UV_TCP || addr.sin6_family != AF_INET6) {
-    uv__set_artificial_error(handle->loop, UV_EFAULT);
+    uv__set_artificial_error(handle->loop, UV_EINVAL);
     return -1;
   }
 
@@ -219,7 +219,7 @@ int uv_tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6 addr) {
 int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr,
     unsigned int flags) {
   if (handle->type != UV_UDP || addr.sin_family != AF_INET) {
-    uv__set_artificial_error(handle->loop, UV_EFAULT);
+    uv__set_artificial_error(handle->loop, UV_EINVAL);
     return -1;
   }
 
@@ -230,7 +230,7 @@ int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr,
 int uv_udp_bind6(uv_udp_t* handle, struct sockaddr_in6 addr,
     unsigned int flags) {
   if (handle->type != UV_UDP || addr.sin6_family != AF_INET6) {
-    uv__set_artificial_error(handle->loop, UV_EFAULT);
+    uv__set_artificial_error(handle->loop, UV_EINVAL);
     return -1;
   }
 
index 56b4623..6d2cde3 100644 (file)
@@ -615,8 +615,7 @@ int uv_udp_set_membership(uv_udp_t* handle, const char* multicast_addr,
       optname = IP_DROP_MEMBERSHIP;
       break;
     default:
-      uv__set_artificial_error(handle->loop, UV_EFAULT);
-      return -1;
+      return uv__set_artificial_error(handle->loop, UV_EINVAL);
   }
 
   if (setsockopt(handle->socket,
index 03cf42e..4249535 100644 (file)
@@ -128,7 +128,7 @@ TEST_IMPL(tcp_bind_error_fault) {
   r = uv_tcp_bind(&server, *garbage_addr);
   ASSERT(r == -1);
 
-  ASSERT(uv_last_error(uv_default_loop()).code == UV_EFAULT);
+  ASSERT(uv_last_error(uv_default_loop()).code == UV_EINVAL);
 
   uv_close((uv_handle_t*)&server, close_cb);
 
index f9f099e..61afc7f 100644 (file)
@@ -103,7 +103,7 @@ TEST_IMPL(tcp_bind6_error_fault) {
   r = uv_tcp_bind6(&server, *garbage_addr);
   ASSERT(r == -1);
 
-  ASSERT(uv_last_error(uv_default_loop()).code == UV_EFAULT);
+  ASSERT(uv_last_error(uv_default_loop()).code == UV_EINVAL);
 
   uv_close((uv_handle_t*)&server, close_cb);
 
index 78938f9..f000c1a 100644 (file)
@@ -195,6 +195,7 @@ TEST_IMPL(threadpool_cancel_getaddrinfo) {
 
   cleanup_threadpool();
 
+  MAKE_VALGRIND_HAPPY();
   return 0;
 }
 
@@ -220,6 +221,7 @@ TEST_IMPL(threadpool_cancel_work) {
 
   cleanup_threadpool();
 
+  MAKE_VALGRIND_HAPPY();
   return 0;
 }
 
@@ -271,6 +273,7 @@ TEST_IMPL(threadpool_cancel_fs) {
 
   cleanup_threadpool();
 
+  MAKE_VALGRIND_HAPPY();
   return 0;
 }
 
@@ -303,5 +306,6 @@ TEST_IMPL(threadpool_cancel_single) {
   ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
   ASSERT(req.data != NULL);  /* Should have been updated by nop_done_cb(). */
 
+  MAKE_VALGRIND_HAPPY();
   return 0;
 }
index d7b1963..6ec5aa2 100644 (file)
             'defines': [
               '_LARGEFILE_SOURCE',
               '_FILE_OFFSET_BITS=64',
-              '_POSIX_C_SOURCE=200112',
             ],
           }],
           ['OS == "mac"', {
-            'defines': [
-              '_DARWIN_USE_64_BIT_INODE=1',
-              '_DARWIN_C_SOURCE',  # _POSIX_C_SOURCE hides SysV definitions.
-            ],
+            'defines': [ '_DARWIN_USE_64_BIT_INODE=1' ],
+          }],
+          ['OS == "linux"', {
+            'defines': [ '_POSIX_C_SOURCE=200112' ],
           }],
         ],
       },