Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
uv: upgrade to da59427
  • Loading branch information
piscisaureus committed Jun 21, 2012
1 parent 57d53a4 commit ae7a3cd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions deps/uv/include/uv.h
Expand Up @@ -316,8 +316,8 @@ typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle, const char* filename,

typedef void (*uv_fs_poll_cb)(uv_fs_poll_t* handle,
int status,
uv_statbuf_t* prev,
uv_statbuf_t* curr);
const uv_statbuf_t* prev,
const uv_statbuf_t* curr);

typedef enum {
UV_LEAVE_GROUP = 0,
Expand Down
4 changes: 3 additions & 1 deletion deps/uv/src/fs-poll.c
Expand Up @@ -30,6 +30,8 @@ static int statbuf_eq(const uv_statbuf_t* a, const uv_statbuf_t* b);
static void timer_cb(uv_timer_t* timer, int status);
static void poll_cb(uv_fs_t* req);

static uv_statbuf_t zero_statbuf;


int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle) {
/* TODO(bnoordhuis) Mark fs_req internal. */
Expand Down Expand Up @@ -141,7 +143,7 @@ static void poll_cb(uv_fs_t* req) {
if (req->result != 0) {
if (handle->busy_polling != -req->errorno) {
uv__set_artificial_error(handle->loop, req->errorno);
handle->poll_cb(handle, -1, NULL, NULL);
handle->poll_cb(handle, -1, &handle->statbuf, &zero_statbuf);
handle->busy_polling = -req->errorno;
}
goto out;
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/src/win/fs.c
Expand Up @@ -56,7 +56,7 @@
#define QUEUE_FS_TP_JOB(loop, req) \
if (!QueueUserWorkItem(&uv_fs_thread_proc, \
req, \
WT_EXECUTELONGFUNCTION)) { \
WT_EXECUTEDEFAULT)) { \
uv__set_sys_error((loop), GetLastError()); \
return -1; \
} \
Expand Down
37 changes: 18 additions & 19 deletions deps/uv/test/test-fs-poll.c
Expand Up @@ -30,8 +30,8 @@ static void timer_cb(uv_timer_t* handle, int status);
static void close_cb(uv_handle_t* handle);
static void poll_cb(uv_fs_poll_t* handle,
int status,
uv_statbuf_t* prev,
uv_statbuf_t* curr);
const uv_statbuf_t* prev,
const uv_statbuf_t* curr);

static uv_fs_poll_t poll_handle;
static uv_timer_t timer_handle;
Expand Down Expand Up @@ -74,50 +74,49 @@ static void timer_cb(uv_timer_t* handle, int status) {

static void poll_cb(uv_fs_poll_t* handle,
int status,
uv_statbuf_t* prev,
uv_statbuf_t* curr) {
const uv_statbuf_t* prev,
const uv_statbuf_t* curr) {
const static uv_statbuf_t zero_statbuf;

ASSERT(handle == &poll_handle);
ASSERT(uv_is_active((uv_handle_t*)handle));
ASSERT(prev != NULL);
ASSERT(curr != NULL);

switch (poll_cb_called++) {
case 0:
ASSERT(status == -1);
ASSERT(prev == NULL);
ASSERT(curr == NULL);
ASSERT(uv_last_error(loop).code == UV_ENOENT);
ASSERT(0 == memcmp(prev, &zero_statbuf, sizeof(zero_statbuf)));
ASSERT(0 == memcmp(curr, &zero_statbuf, sizeof(zero_statbuf)));
touch_file(FIXTURE);
break;

case 1:
ASSERT(status == 0);
ASSERT(prev != NULL);
ASSERT(curr != NULL);
{
uv_statbuf_t buf;
memset(&buf, 0, sizeof(buf));
ASSERT(0 == memcmp(&buf, prev, sizeof(buf)));
}
ASSERT(0 == memcmp(prev, &zero_statbuf, sizeof(zero_statbuf)));
ASSERT(0 != memcmp(curr, &zero_statbuf, sizeof(zero_statbuf)));
ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 20, 0));
break;

case 2:
ASSERT(status == 0);
ASSERT(prev != NULL);
ASSERT(curr != NULL);
ASSERT(0 != memcmp(prev, &zero_statbuf, sizeof(zero_statbuf)));
ASSERT(0 != memcmp(curr, &zero_statbuf, sizeof(zero_statbuf)));
ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 200, 0));
break;

case 3:
ASSERT(status == 0);
ASSERT(prev != NULL);
ASSERT(curr != NULL);
ASSERT(0 != memcmp(prev, &zero_statbuf, sizeof(zero_statbuf)));
ASSERT(0 != memcmp(curr, &zero_statbuf, sizeof(zero_statbuf)));
remove(FIXTURE);
break;

case 4:
ASSERT(status == -1);
ASSERT(prev == NULL);
ASSERT(curr == NULL);
ASSERT(0 != memcmp(prev, &zero_statbuf, sizeof(zero_statbuf)));
ASSERT(0 == memcmp(curr, &zero_statbuf, sizeof(zero_statbuf)));
ASSERT(uv_last_error(loop).code == UV_ENOENT);
uv_close((uv_handle_t*)handle, close_cb);
break;
Expand Down

0 comments on commit ae7a3cd

Please sign in to comment.