Browse Source

deps: upgrade libuv to b86ed94

v0.9.4-release
Fedor Indutny 12 years ago
parent
commit
ba754524a9
  1. 8
      deps/uv/src/unix/kqueue.c
  2. 2
      deps/uv/src/unix/sunos.c
  3. 8
      deps/uv/src/unix/udp.c
  4. 4
      deps/uv/test/benchmark-getaddrinfo.c
  5. 4
      deps/uv/test/benchmark-ping-pongs.c
  6. 18
      deps/uv/test/run-tests.c
  7. 8
      deps/uv/test/runner-unix.c
  8. 31
      deps/uv/test/test-fs-event.c
  9. 4
      deps/uv/test/test-getaddrinfo.c
  10. 2
      deps/uv/test/test-list.h
  11. 7
      deps/uv/test/test-ping-pong.c

8
deps/uv/src/unix/kqueue.c

@ -197,7 +197,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
/* TODO batch up */
struct kevent events[1];
EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0);
if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL)) abort();
if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL))
if (errno != ENOENT)
abort();
}
}
@ -208,7 +210,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
/* TODO batch up */
struct kevent events[1];
EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0);
if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL)) abort();
if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL))
if (errno != ENOENT)
abort();
}
}

2
deps/uv/src/unix/sunos.c

@ -376,7 +376,7 @@ int uv_fs_event_init(uv_loop_t* loop,
void uv__fs_event_close(uv_fs_event_t* handle) {
if (handle->fd == PORT_FIRED) {
if (handle->fd == PORT_FIRED || handle->fd == PORT_LOADED) {
port_dissociate(handle->loop->fs_fd, PORT_SOURCE_FILE, (uintptr_t)&handle->fo);
}
handle->fd = PORT_DELETED;

8
deps/uv/src/unix/udp.c

@ -446,14 +446,12 @@ static int uv__udp_send(uv_udp_send_t* req,
int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) {
memset(handle, 0, sizeof *handle);
uv__handle_init(loop, (uv_handle_t*)handle, UV_UDP);
handle->io_watcher.fd = -1;
handle->alloc_cb = NULL;
handle->recv_cb = NULL;
uv__io_init(&handle->io_watcher, uv__udp_io, -1);
ngx_queue_init(&handle->write_queue);
ngx_queue_init(&handle->write_completed_queue);
uv__io_init(&handle->io_watcher, uv__udp_io, -1);
return 0;
}

4
deps/uv/test/benchmark-getaddrinfo.c

@ -21,11 +21,7 @@
#include "uv.h"
#include "task.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h> /* strlen */
#define CONCURRENT_CALLS 10
#define TOTAL_CALLS 10000

4
deps/uv/test/benchmark-ping-pongs.c

@ -24,7 +24,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h> /* strlen */
/* Run the benchmark for this many ms */
#define TIME 5000
@ -103,8 +102,7 @@ static void pinger_write_ping(pinger_t* pinger) {
uv_write_t* req;
uv_buf_t buf;
buf.base = (char*)&PING;
buf.len = strlen(PING);
buf = uv_buf_init(PING, sizeof(PING) - 1);
req = malloc(sizeof *req);
if (uv_write(req, (uv_stream_t*) &pinger->tcp, &buf, 1, pinger_write_cb)) {

18
deps/uv/test/run-tests.c

@ -19,6 +19,7 @@
* IN THE SOFTWARE.
*/
#include <errno.h>
#include <stdio.h>
#include <string.h>
@ -99,7 +100,7 @@ static int maybe_run_test(int argc, char **argv) {
if (strcmp(argv[1], "spawn_helper3") == 0) {
char buffer[256];
fgets(buffer, sizeof(buffer) - 1, stdin);
ASSERT(buffer == fgets(buffer, sizeof(buffer) - 1, stdin));
buffer[sizeof(buffer) - 1] = '\0';
fputs(buffer, stdout);
return 1;
@ -111,13 +112,20 @@ static int maybe_run_test(int argc, char **argv) {
}
if (strcmp(argv[1], "spawn_helper5") == 0) {
const char* out = "fourth stdio!\n\0";
const char out[] = "fourth stdio!\n";
#ifdef _WIN32
DWORD bytes;
WriteFile((HANDLE) _get_osfhandle(3), out, strlen(out), &bytes, NULL);
WriteFile((HANDLE) _get_osfhandle(3), out, sizeof(out) - 1, &bytes, NULL);
#else
write(3, out, strlen(out));
fsync(3);
{
ssize_t r;
do
r = write(3, out, sizeof(out) - 1);
while (r == -1 && errno == EINTR);
fsync(3);
}
#endif
return 1;
}

8
deps/uv/test/runner-unix.c

@ -24,6 +24,7 @@
#include <stdint.h> /* uintptr_t */
#include <errno.h>
#include <unistd.h> /* usleep */
#include <string.h> /* strdup */
#include <stdio.h>
@ -146,8 +147,11 @@ static void* dowait(void* data) {
if (args->pipe[1] >= 0) {
/* Write a character to the main thread to notify it about this. */
char c = 0;
write(args->pipe[1], &c, 1);
ssize_t r;
do
r = write(args->pipe[1], "", 1);
while (r == -1 && errno == EINTR);
}
return NULL;

31
deps/uv/test/test-fs-event.c

@ -296,6 +296,37 @@ TEST_IMPL(fs_event_watch_file_current_dir) {
return 0;
}
TEST_IMPL(fs_event_no_callback_after_close) {
uv_loop_t* loop = uv_default_loop();
int r;
/* Setup */
remove("watch_dir/file1");
remove("watch_dir/");
create_dir(loop, "watch_dir");
create_file(loop, "watch_dir/file1");
r = uv_fs_event_init(loop,
&fs_event,
"watch_dir/file1",
fs_event_cb_file,
0);
ASSERT(r != -1);
uv_close((uv_handle_t*)&fs_event, close_cb);
touch_file(loop, "watch_dir/file1");
uv_run(loop);
ASSERT(fs_event_cb_called == 0);
ASSERT(close_cb_called == 1);
/* Cleanup */
remove("watch_dir/file1");
remove("watch_dir/");
MAKE_VALGRIND_HAPPY();
return 0;
}
TEST_IMPL(fs_event_no_callback_on_close) {
uv_loop_t* loop = uv_default_loop();

4
deps/uv/test/test-getaddrinfo.c

@ -21,11 +21,7 @@
#include "uv.h"
#include "task.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h> /* strlen */
#define CONCURRENT_COUNT 10

2
deps/uv/test/test-list.h

@ -177,6 +177,7 @@ TEST_DECLARE (fs_event_watch_dir)
TEST_DECLARE (fs_event_watch_file)
TEST_DECLARE (fs_event_watch_file_twice)
TEST_DECLARE (fs_event_watch_file_current_dir)
TEST_DECLARE (fs_event_no_callback_after_close)
TEST_DECLARE (fs_event_no_callback_on_close)
TEST_DECLARE (fs_event_immediate_close)
TEST_DECLARE (fs_event_close_with_pending_event)
@ -450,6 +451,7 @@ TASK_LIST_START
TEST_ENTRY (fs_event_watch_file)
TEST_ENTRY (fs_event_watch_file_twice)
TEST_ENTRY (fs_event_watch_file_current_dir)
TEST_ENTRY (fs_event_no_callback_after_close)
TEST_ENTRY (fs_event_no_callback_on_close)
TEST_ENTRY (fs_event_immediate_close)
TEST_ENTRY (fs_event_close_with_pending_event)

7
deps/uv/test/test-ping-pong.c

@ -24,7 +24,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h> /* strlen */
static int completed_pingers = 0;
@ -77,11 +76,9 @@ static void pinger_write_ping(pinger_t* pinger) {
uv_write_t *req;
uv_buf_t buf;
buf.base = (char*)&PING;
buf.len = strlen(PING);
req = malloc(sizeof(uv_write_t));
buf = uv_buf_init(PING, sizeof(PING) - 1);
req = malloc(sizeof(*req));
if (uv_write(req, (uv_stream_t*)&pinger->stream.tcp, &buf, 1, pinger_after_write)) {
FATAL("uv_write failed");
}

Loading…
Cancel
Save