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

Commit

Permalink
uv: upgrade to 69c2ef8
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Jul 31, 2012
1 parent de16da5 commit 80ab9a8
Show file tree
Hide file tree
Showing 7 changed files with 593 additions and 566 deletions.
15 changes: 11 additions & 4 deletions deps/uv/include/uv-private/uv-win.h
Expand Up @@ -23,6 +23,12 @@
# define _WIN32_WINNT 0x0502
#endif

#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
typedef intptr_t ssize_t;
# define _SSIZE_T_
# define _SSIZE_T_DEFINED
#endif

#include <process.h>
#include <stdint.h>
#include <winsock2.h>
Expand Down Expand Up @@ -470,15 +476,16 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
int flags; \
DWORD sys_errno_; \
union { \
wchar_t* pathw; \
int file; \
/* TODO: remove me in 0.9. */ \
WCHAR* pathw; \
int fd; \
}; \
union { \
struct { \
int mode; \
wchar_t* new_pathw; \
WCHAR* new_pathw; \
int file_flags; \
int file_out; \
int fd_out; \
void* buf; \
size_t length; \
int64_t offset; \
Expand Down
10 changes: 2 additions & 8 deletions deps/uv/include/uv.h
Expand Up @@ -57,12 +57,6 @@ extern "C" {

#include "ares.h"

#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
typedef intptr_t ssize_t;
# define _SSIZE_T_
# define _SSIZE_T_DEFINED
#endif

#if defined(__unix__) || defined(__POSIX__) || defined(__APPLE__)
# include "uv-private/uv-unix.h"
#else
Expand Down Expand Up @@ -1410,8 +1404,8 @@ struct uv_fs_s {
uv_fs_cb cb;
ssize_t result;
void* ptr;
char* path;
int errorno;
const char* path;
uv_err_code errorno;
UV_FS_PRIVATE_FIELDS
};

Expand Down
20 changes: 15 additions & 5 deletions deps/uv/src/unix/sunos.c
Expand Up @@ -129,7 +129,7 @@ static void uv__fs_event_rearm(uv_fs_event_t *handle) {


static void uv__fs_event_read(EV_P_ ev_io* w, int revents) {
uv_fs_event_t *handle;
uv_fs_event_t *handle = NULL;
uv_loop_t *loop_;
timespec_t timeout;
port_event_t pe;
Expand All @@ -139,15 +139,25 @@ static void uv__fs_event_read(EV_P_ ev_io* w, int revents) {
loop_ = container_of(w, uv_loop_t, fs_event_watcher);

do {
/* TODO use port_getn() */
uint_t n = 1;

/*
* Note that our use of port_getn() here (and not port_get()) is deliberate:
* there is a bug in event ports (Sun bug 6456558) whereby a zeroed timeout
* causes port_get() to return success instead of ETIME when there aren't
* actually any events (!); by using port_getn() in lieu of port_get(),
* we can at least workaround the bug by checking for zero returned events
* and treating it as we would ETIME.
*/
do {
memset(&timeout, 0, sizeof timeout);
r = port_get(loop_->fs_fd, &pe, &timeout);
r = port_getn(loop_->fs_fd, &pe, 1, &n, &timeout);
}
while (r == -1 && errno == EINTR);

if (r == -1 && errno == ETIME)
if ((r == -1 && errno == ETIME) || n == 0)
break;

handle = (uv_fs_event_t *)pe.portev_user;
assert((r == 0) && "unexpected port_get() error");

Expand All @@ -162,7 +172,7 @@ static void uv__fs_event_read(EV_P_ ev_io* w, int revents) {
}
while (handle->fd != PORT_DELETED);

if (handle->fd != PORT_DELETED)
if (handle != NULL && handle->fd != PORT_DELETED)
uv__fs_event_rearm(handle);
}

Expand Down

0 comments on commit 80ab9a8

Please sign in to comment.