summaryrefslogtreecommitdiff
path: root/deps/uv
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2012-01-23 22:39:49 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2012-01-24 00:11:44 +0100
commit986e61255736a74fad1d96cc928f049c93734e05 (patch)
tree588e3f832e7c06479f9a650fb1cba3571c0af8e3 /deps/uv
parent57ddf5f50ae3c7e3fe463da9a36c3e0bd615519c (diff)
downloadnode-new-986e61255736a74fad1d96cc928f049c93734e05.tar.gz
uv: upgrade to b88bc43
Diffstat (limited to 'deps/uv')
-rw-r--r--deps/uv/include/uv.h34
-rw-r--r--deps/uv/src/unix/error.c1
-rw-r--r--deps/uv/src/unix/udp.c30
-rw-r--r--deps/uv/src/win/error.c1
-rw-r--r--deps/uv/src/win/tty.c28
-rw-r--r--deps/uv/src/win/udp.c12
-rw-r--r--deps/uv/test/test-fs.c36
-rw-r--r--deps/uv/test/test-list.h2
8 files changed, 122 insertions, 22 deletions
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
index fb4e40ab4c..629435274e 100644
--- a/deps/uv/include/uv.h
+++ b/deps/uv/include/uv.h
@@ -115,7 +115,8 @@ typedef intptr_t ssize_t;
XX( 45, EAISOCKTYPE, "") \
XX( 46, ESHUTDOWN, "") \
XX( 47, EEXIST, "file already exists") \
- XX( 48, ESRCH, "no such process")
+ XX( 48, ESRCH, "no such process") \
+ XX( 49, ENAMETOOLONG, "name too long")
#define UV_ERRNO_GEN(val, name, s) UV_##name = val,
@@ -632,6 +633,20 @@ UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle,
uv_membership membership);
/*
+ * Set IP multicast loop flag. Makes multicast packets loop back to
+ * local sockets.
+ *
+ * Arguments:
+ * handle UDP handle. Should have been initialized with
+ * `uv_udp_init`.
+ * on 1 for on, 0 for off
+ *
+ * Returns:
+ * 0 on success, -1 on error.
+ */
+UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on);
+
+/*
* Set the multicast ttl
*
* Arguments:
@@ -642,7 +657,7 @@ UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle,
* Returns:
* 0 on success, -1 on error.
*/
-int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl);
+UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl);
/*
* Set broadcast on or off
@@ -655,7 +670,20 @@ int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl);
* Returns:
* 0 on success, -1 on error.
*/
-int uv_udp_set_broadcast(uv_udp_t* handle, int on);
+UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on);
+
+/*
+ * Set the time to live
+ *
+ * Arguments:
+ * handle UDP handle. Should have been initialized with
+ * `uv_udp_init`.
+ * ttl 1 through 255
+ *
+ * Returns:
+ * 0 on success, -1 on error.
+ */
+UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl);
/*
* Send data. If the socket has not previously been bound with `uv_udp_bind`
diff --git a/deps/uv/src/unix/error.c b/deps/uv/src/unix/error.c
index e904d39033..80d3270db0 100644
--- a/deps/uv/src/unix/error.c
+++ b/deps/uv/src/unix/error.c
@@ -71,6 +71,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case EFAULT: return UV_EFAULT;
case EMFILE: return UV_EMFILE;
case EMSGSIZE: return UV_EMSGSIZE;
+ case ENAMETOOLONG: return UV_ENAMETOOLONG;
case EINVAL: return UV_EINVAL;
case ECONNREFUSED: return UV_ECONNREFUSED;
case EADDRINUSE: return UV_EADDRINUSE;
diff --git a/deps/uv/src/unix/udp.c b/deps/uv/src/unix/udp.c
index 0ebfe7079c..3e5de92948 100644
--- a/deps/uv/src/unix/udp.c
+++ b/deps/uv/src/unix/udp.c
@@ -509,27 +509,25 @@ int uv_udp_set_membership(uv_udp_t* handle, const char* multicast_addr,
return 0;
}
-int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) {
- if (setsockopt(handle->fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof ttl) == -1) {
- uv__set_sys_error(handle->loop, errno);
- return -1;
- }
-
- return 0;
-}
-int uv_udp_set_broadcast(uv_udp_t* handle, int on) {
- if (setsockopt(handle->fd, SOL_SOCKET, SO_BROADCAST, &on, sizeof on) == -1) {
- uv__set_sys_error(handle->loop, errno);
- return -1;
+#define X(name, level, option) \
+ int uv_udp_set_##name(uv_udp_t* handle, int flag) { \
+ if (setsockopt(handle->fd, level, option, &flag, sizeof(flag))) { \
+ uv__set_sys_error(handle->loop, errno); \
+ return -1; \
+ } \
+ return 0; \
}
- return 0;
-}
+X(multicast_loop, IPPROTO_IP, IP_MULTICAST_LOOP)
+X(multicast_ttl, IPPROTO_IP, IP_MULTICAST_TTL)
+X(broadcast, SOL_SOCKET, SO_BROADCAST)
+X(ttl, IPPROTO_IP, IP_TTL)
+
+#undef X
-int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name,
- int* namelen) {
+int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name, int* namelen) {
socklen_t socklen;
int saved_errno;
int rv = 0;
diff --git a/deps/uv/src/win/error.c b/deps/uv/src/win/error.c
index 12ce4d1b5d..59c9ea8346 100644
--- a/deps/uv/src/win/error.c
+++ b/deps/uv/src/win/error.c
@@ -94,6 +94,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case WSAEMSGSIZE: return UV_EMSGSIZE;
case ERROR_NETWORK_UNREACHABLE: return UV_ENETUNREACH;
case WSAENETUNREACH: return UV_ENETUNREACH;
+ case WSAENOBUFS: return UV_ENOBUFS;
case ERROR_OUTOFMEMORY: return UV_ENOMEM;
case ERROR_NOT_CONNECTED: return UV_ENOTCONN;
case WSAENOTCONN: return UV_ENOTCONN;
diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c
index 88c68954c9..e61fc7e28e 100644
--- a/deps/uv/src/win/tty.c
+++ b/deps/uv/src/win/tty.c
@@ -1069,13 +1069,26 @@ static int uv_tty_set_style(uv_tty_t* handle, DWORD* error) {
bg_bright = 0;
} else if (arg == 1) {
- /* Bright */
+ /* Foreground bright on */
fg_bright = 1;
+ } else if (arg == 2) {
+ /* Both bright off */
+ fg_bright = 0;
+ bg_bright = 0;
+
+ } else if (arg == 5) {
+ /* Background bright on */
+ bg_bright = 1;
+
} else if (arg == 21 || arg == 22) {
- /* Bright off. */
+ /* Foreground bright off */
fg_bright = 0;
+ } else if (arg == 25) {
+ /* Background bright off */
+ bg_bright = 0;
+
} else if (arg >= 30 && arg <= 37) {
/* Set foreground color */
fg_color = arg - 30;
@@ -1091,6 +1104,17 @@ static int uv_tty_set_style(uv_tty_t* handle, DWORD* error) {
} else if (arg == 49) {
/* Default background color */
bg_color = 0;
+
+ } else if (arg >= 90 && arg <= 97) {
+ /* Set bold foreground color */
+ fg_bright = 1;
+ fg_color = arg - 90;
+
+ } else if (arg >= 100 && arg <= 107) {
+ /* Set bold background color */
+ bg_bright = 1;
+ bg_color = arg - 100;
+
}
}
diff --git a/deps/uv/src/win/udp.c b/deps/uv/src/win/udp.c
index 8a36396b47..0a9990a5b7 100644
--- a/deps/uv/src/win/udp.c
+++ b/deps/uv/src/win/udp.c
@@ -579,6 +579,12 @@ void uv_process_udp_send_req(uv_loop_t* loop, uv_udp_t* handle,
}
+int uv_udp_set_multicast_loop(uv_udp_t* handle, int on) {
+ uv__set_artificial_error(handle->loop, UV_ENOSYS);
+ return -1;
+}
+
+
int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) {
if (setsockopt(handle->socket, IPPROTO_IP, IP_MULTICAST_TTL,
(const char*)&ttl, sizeof ttl) == -1) {
@@ -599,3 +605,9 @@ int uv_udp_set_broadcast(uv_udp_t* handle, int on) {
return 0;
}
+
+
+int uv_udp_set_ttl(uv_udp_t* handle, int ttl) {
+ uv__set_artificial_error(handle->loop, UV_ENOSYS);
+ return -1;
+}
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
index 763af8a78d..b8e0ee6567 100644
--- a/deps/uv/test/test-fs.c
+++ b/deps/uv/test/test-fs.c
@@ -45,6 +45,7 @@
# define close _close
#endif
+#define TOO_LONG_NAME_LENGTH 8192
typedef struct {
const char* path;
@@ -416,6 +417,14 @@ static void open_noent_cb(uv_fs_t* req) {
uv_fs_req_cleanup(req);
}
+static void open_nametoolong_cb(uv_fs_t* req) {
+ ASSERT(req->fs_type == UV_FS_OPEN);
+ ASSERT(req->errorno == UV_ENAMETOOLONG);
+ ASSERT(req->result == -1);
+ open_cb_count++;
+ uv_fs_req_cleanup(req);
+}
+
TEST_IMPL(fs_file_noent) {
uv_fs_t req;
@@ -441,6 +450,31 @@ TEST_IMPL(fs_file_noent) {
return 0;
}
+TEST_IMPL(fs_file_nametoolong) {
+ uv_fs_t req;
+ int r;
+
+ loop = uv_default_loop();
+
+ char name[TOO_LONG_NAME_LENGTH + 1];
+ memset(name, 'a', TOO_LONG_NAME_LENGTH);
+ name[TOO_LONG_NAME_LENGTH] = 0;
+
+ r = uv_fs_open(loop, &req, name, O_RDONLY, 0, NULL);
+ ASSERT(r == -1);
+ ASSERT(req.result == -1);
+ ASSERT(uv_last_error(loop).code == UV_ENAMETOOLONG);
+ uv_fs_req_cleanup(&req);
+
+ r = uv_fs_open(loop, &req, name, O_RDONLY, 0, open_nametoolong_cb);
+ ASSERT(r == 0);
+
+ ASSERT(open_cb_count == 0);
+ uv_run(loop);
+ ASSERT(open_cb_count == 1);
+
+ return 0;
+}
static void check_utime(const char* path, double atime, double mtime) {
struct stat* s;
@@ -1543,4 +1577,4 @@ TEST_IMPL(fs_rename_to_existing_file) {
unlink("test_file2");
return 0;
-} \ No newline at end of file
+}
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index 5ff162301f..fa9390f9c7 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -103,6 +103,7 @@ TEST_DECLARE (spawn_and_kill)
TEST_DECLARE (spawn_and_ping)
TEST_DECLARE (kill)
TEST_DECLARE (fs_file_noent)
+TEST_DECLARE (fs_file_nametoolong)
TEST_DECLARE (fs_file_async)
TEST_DECLARE (fs_file_sync)
TEST_DECLARE (fs_async_dir)
@@ -269,6 +270,7 @@ TASK_LIST_START
#endif
TEST_ENTRY (fs_file_noent)
+ TEST_ENTRY (fs_file_nametoolong)
TEST_ENTRY (fs_file_async)
TEST_ENTRY (fs_file_sync)
TEST_ENTRY (fs_async_dir)