Skip to content

Commit

Permalink
deps: upgrade libuv to 7841f77
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Jan 22, 2013
1 parent d5a5901 commit 814bdf0
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 33 deletions.
15 changes: 11 additions & 4 deletions deps/uv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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

Expand Down
45 changes: 44 additions & 1 deletion deps/uv/src/unix/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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__) \
Expand Down
4 changes: 2 additions & 2 deletions deps/uv/src/unix/linux/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
22 changes: 11 additions & 11 deletions deps/uv/src/unix/linux/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
#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
Expand Down Expand Up @@ -71,21 +71,21 @@

#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]; */
};

Expand All @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions deps/uv/src/unix/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions deps/uv/src/uv-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions deps/uv/src/win/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/test/test-tcp-bind-error.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion deps/uv/test/test-tcp-bind6-error.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 4 additions & 0 deletions deps/uv/test/test-threadpool-cancel.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ TEST_IMPL(threadpool_cancel_getaddrinfo) {

cleanup_threadpool();

MAKE_VALGRIND_HAPPY();
return 0;
}

Expand All @@ -220,6 +221,7 @@ TEST_IMPL(threadpool_cancel_work) {

cleanup_threadpool();

MAKE_VALGRIND_HAPPY();
return 0;
}

Expand Down Expand Up @@ -271,6 +273,7 @@ TEST_IMPL(threadpool_cancel_fs) {

cleanup_threadpool();

MAKE_VALGRIND_HAPPY();
return 0;
}

Expand Down Expand Up @@ -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;
}
9 changes: 4 additions & 5 deletions deps/uv/uv.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@
'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' ],
}],
],
},
Expand Down

0 comments on commit 814bdf0

Please sign in to comment.