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 v0.10.16
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Sep 5, 2013
1 parent 8b05206 commit 6301613
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 50 deletions.
19 changes: 18 additions & 1 deletion deps/uv/ChangeLog
@@ -1,4 +1,21 @@
2013.08.24, Version 0.10.15 (Stable)
2013.09.06, Version 0.10.16 (Stable)

Changes since version 0.10.15:

* windows: make uv_shutdown() for write-only pipes work (Bert Belder)

* windows: make uv_fs_open() report EINVAL when invalid arguments are passed
(Bert Belder)

* windows: make uv_fs_open() report _open_osfhandle() failure correctly (Bert
Belder)

* windows: make uv_fs_chmod() report errors correctly (Bert Belder)

* windows: wrap multi-statement macros in do..while block (Bert Belder)


2013.08.24, Version 0.10.15 (Stable), 221078a8fdd9b853c6b557b3d9a5dd744b4fdd6b

Changes since version 0.10.14:

Expand Down
2 changes: 1 addition & 1 deletion deps/uv/src/version.c
Expand Up @@ -34,7 +34,7 @@

#define UV_VERSION_MAJOR 0
#define UV_VERSION_MINOR 10
#define UV_VERSION_PATCH 15
#define UV_VERSION_PATCH 16
#define UV_VERSION_IS_RELEASE 1


Expand Down
104 changes: 62 additions & 42 deletions deps/uv/src/win/fs.c
Expand Up @@ -41,33 +41,41 @@


#define QUEUE_FS_TP_JOB(loop, req) \
if (!QueueUserWorkItem(&uv_fs_thread_proc, \
req, \
WT_EXECUTEDEFAULT)) { \
uv__set_sys_error((loop), GetLastError()); \
return -1; \
} \
uv__req_register(loop, req);
do { \
if (!QueueUserWorkItem(&uv_fs_thread_proc, \
req, \
WT_EXECUTEDEFAULT)) { \
uv__set_sys_error((loop), GetLastError()); \
return -1; \
} \
uv__req_register(loop, req); \
} while (0)

#define SET_UV_LAST_ERROR_FROM_REQ(req) \
uv__set_error(req->loop, req->errorno, req->sys_errno_);
uv__set_error(req->loop, req->errorno, req->sys_errno_)

#define SET_REQ_RESULT(req, result_value) \
req->result = (result_value); \
if (req->result == -1) { \
req->sys_errno_ = _doserrno; \
req->errorno = uv_translate_sys_error(req->sys_errno_); \
}
do { \
req->result = (result_value); \
if (req->result == -1) { \
req->sys_errno_ = _doserrno; \
req->errorno = uv_translate_sys_error(req->sys_errno_); \
} \
} while (0)

#define SET_REQ_WIN32_ERROR(req, sys_errno) \
req->result = -1; \
req->sys_errno_ = (sys_errno); \
req->errorno = uv_translate_sys_error(req->sys_errno_);
do { \
req->result = -1; \
req->sys_errno_ = (sys_errno); \
req->errorno = uv_translate_sys_error(req->sys_errno_); \
} while (0)

#define SET_REQ_UV_ERROR(req, uv_errno, sys_errno) \
req->result = -1; \
req->sys_errno_ = (sys_errno); \
req->errorno = (uv_errno);
do { \
req->result = -1; \
req->sys_errno_ = (sys_errno); \
req->errorno = (uv_errno); \
} while (0)

#define VERIFY_FD(fd, req) \
if (fd == -1) { \
Expand All @@ -78,7 +86,7 @@
}

#define FILETIME_TO_TIME_T(filetime) \
((*((uint64_t*) &(filetime)) - 116444736000000000ULL) / 10000000ULL);
((*((uint64_t*) &(filetime)) - 116444736000000000ULL) / 10000000ULL)

#define TIME_T_TO_FILETIME(time, filetime_ptr) \
do { \
Expand Down Expand Up @@ -392,7 +400,7 @@ void fs__open(uv_fs_t* req) {
DWORD disposition;
DWORD attributes = 0;
HANDLE file;
int result, current_umask;
int fd, current_umask;
int flags = req->file_flags;

/* Obtain the active umask. umask() never fails and returns the previous */
Expand All @@ -413,8 +421,7 @@ void fs__open(uv_fs_t* req) {
access = FILE_GENERIC_READ | FILE_GENERIC_WRITE;
break;
default:
result = -1;
goto end;
goto einval;
}

if (flags & _O_APPEND) {
Expand Down Expand Up @@ -451,8 +458,7 @@ void fs__open(uv_fs_t* req) {
disposition = CREATE_ALWAYS;
break;
default:
result = -1;
goto end;
goto einval;
}

attributes |= FILE_ATTRIBUTE_NORMAL;
Expand Down Expand Up @@ -481,8 +487,7 @@ void fs__open(uv_fs_t* req) {
attributes |= FILE_FLAG_RANDOM_ACCESS;
break;
default:
result = -1;
goto end;
goto einval;
}

/* Setting this flag makes it possible to open a directory. */
Expand All @@ -507,11 +512,30 @@ void fs__open(uv_fs_t* req) {
}
return;
}
result = _open_osfhandle((intptr_t) file, flags);
end:
SET_REQ_RESULT(req, result);

fd = _open_osfhandle((intptr_t) file, flags);
if (fd < 0) {
/* The only known failure mode for _open_osfhandle() is EMFILE, in which
* case GetLastError() will return zero. However we'll try to handle other
* errors as well, should they ever occur.
*/
if (errno == EMFILE)
SET_REQ_UV_ERROR(req, UV_EMFILE, ERROR_TOO_MANY_OPEN_FILES);
else if (GetLastError() != ERROR_SUCCESS)
SET_REQ_WIN32_ERROR(req, GetLastError());
else
SET_REQ_WIN32_ERROR(req, UV_UNKNOWN);
return;
}

SET_REQ_RESULT(req, fd);
return;

einval:
SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER);
}


void fs__close(uv_fs_t* req) {
int fd = req->fd;
int result;
Expand Down Expand Up @@ -1062,25 +1086,24 @@ static void fs__chmod(uv_fs_t* req) {

static void fs__fchmod(uv_fs_t* req) {
int fd = req->fd;
int result;
HANDLE handle;
NTSTATUS nt_status;
IO_STATUS_BLOCK io_status;
FILE_BASIC_INFORMATION file_info;

VERIFY_FD(fd, req);

handle = (HANDLE)_get_osfhandle(fd);
handle = (HANDLE) _get_osfhandle(fd);

nt_status = pNtQueryInformationFile(handle,
&io_status,
&file_info,
sizeof file_info,
FileBasicInformation);

if (nt_status != STATUS_SUCCESS) {
result = -1;
goto done;
if (!NT_SUCCESS(nt_status)) {
SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status));
return;
}

if (req->mode & _S_IWRITE) {
Expand All @@ -1095,15 +1118,12 @@ static void fs__fchmod(uv_fs_t* req) {
sizeof file_info,
FileBasicInformation);

if (nt_status != STATUS_SUCCESS) {
result = -1;
goto done;
if (!NT_SUCCESS(nt_status)) {
SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status));
return;
}

result = 0;

done:
SET_REQ_RESULT(req, result);
SET_REQ_SUCCESS(req);
}


Expand Down
10 changes: 8 additions & 2 deletions deps/uv/src/win/pipe.c
Expand Up @@ -1528,16 +1528,22 @@ void uv_process_pipe_shutdown_req(uv_loop_t* loop, uv_pipe_t* handle,

UNREGISTER_HANDLE_REQ(loop, handle, req);

/* Initialize and optionally start the eof timer. */
/* This makes no sense if we've already seen EOF. */
if (handle->flags & UV_HANDLE_READABLE) {
/* Initialize and optionally start the eof timer. Only do this if the */
/* pipe is readable and we haven't seen EOF come in ourselves. */
eof_timer_init(handle);

/* If reading start the timer right now. */
/* Otherwise uv_pipe_queue_read will start it. */
if (handle->flags & UV_HANDLE_READ_PENDING) {
eof_timer_start(handle);
}

} else {
/* This pipe is not readable. We can just close it to let the other end */
/* know that we're done writing. */
CloseHandle(handle->handle);
handle->handle = INVALID_HANDLE_VALUE;
}

if (req->cb) {
Expand Down
15 changes: 11 additions & 4 deletions deps/uv/src/win/process-stdio.c
Expand Up @@ -104,12 +104,16 @@ static uv_err_t uv__create_stdio_pipe_pair(uv_loop_t* loop,
uv_err_t err;

if (flags & UV_READABLE_PIPE) {
server_access |= PIPE_ACCESS_OUTBOUND;
/* The server needs inbound access too, otherwise CreateNamedPipe() */
/* won't give us the FILE_READ_ATTRIBUTES permission. We need that to */
/* probe the state of the write buffer when we're trying to shutdown */
/* the pipe. */
server_access |= PIPE_ACCESS_OUTBOUND | PIPE_ACCESS_INBOUND;
client_access |= GENERIC_READ | FILE_WRITE_ATTRIBUTES;
}
if (flags & UV_WRITABLE_PIPE) {
server_access |= PIPE_ACCESS_INBOUND;
client_access |= GENERIC_WRITE;
client_access |= GENERIC_WRITE | FILE_READ_ATTRIBUTES;
}

/* Create server pipe handle. */
Expand Down Expand Up @@ -163,8 +167,11 @@ static uv_err_t uv__create_stdio_pipe_pair(uv_loop_t* loop,
}
}

/* The server end is now readable and writable. */
server_pipe->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE;
/* The server end is now readable and/or writable. */
if (flags & UV_READABLE_PIPE)
server_pipe->flags |= UV_HANDLE_WRITABLE;
if (flags & UV_WRITABLE_PIPE)
server_pipe->flags |= UV_HANDLE_READABLE;

*child_pipe_ptr = child_pipe;
return uv_ok_;
Expand Down

0 comments on commit 6301613

Please sign in to comment.