Browse Source

Upgrade libuv to e95a29ee18

Bert Belder 13 years ago
parent
commit
97cf216c74
  1. 6
      deps/uv/src/uv-common.h
  2. 3
      deps/uv/src/win/error.c
  3. 32
      deps/uv/src/win/fs.c
  4. 11
      deps/uv/src/win/winapi.h
  5. 2
      deps/uv/test/test-fs.c

6
deps/uv/src/uv-common.h

@ -31,12 +31,6 @@
#define COUNTOF(a) (sizeof(a) / sizeof(a[0]))
/* Used for the uv_fs_ functions */
#define SET_REQ_RESULT(req, result_value) \
req->result = (result_value); \
if (req->result == -1) { \
req->errorno = errno; \
}
struct uv_ares_task_s {
UV_HANDLE_FIELDS

3
deps/uv/src/win/error.c

@ -96,6 +96,7 @@ char* uv_strerror(uv_err_t err) {
uv_err_code uv_translate_sys_error(int sys_errno) {
switch (sys_errno) {
case ERROR_SUCCESS: return UV_OK;
case ERROR_FILE_NOT_FOUND: return UV_ENOENT;
case ERROR_NOACCESS: return UV_EACCESS;
case WSAEACCES: return UV_EACCESS;
case ERROR_ADDRESS_ALREADY_ASSOCIATED: return UV_EADDRINUSE;
@ -104,6 +105,8 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case WSAEAFNOSUPPORT: return UV_EAFNOSUPPORT;
case WSAEWOULDBLOCK: return UV_EAGAIN;
case WSAEALREADY: return UV_EALREADY;
case ERROR_CONNECTION_ABORTED: return UV_ECONNABORTED;
case WSAECONNABORTED: return UV_ECONNABORTED;
case ERROR_CONNECTION_REFUSED: return UV_ECONNREFUSED;
case WSAECONNREFUSED: return UV_ECONNREFUSED;
case WSAEFAULT: return UV_EFAULT;

32
deps/uv/src/win/fs.c

@ -82,6 +82,17 @@
req->last_error = error; \
req->flags |= UV_FS_LAST_ERROR_SET;
#define SET_REQ_RESULT(req, result_value) \
req->result = (result_value); \
if (req->result == -1) { \
req->errorno = uv_translate_sys_error(_doserrno); \
}
#define SET_REQ_RESULT_WIN32_ERROR(req, sys_errno) \
req->result = -1; \
req->errorno = uv_translate_sys_error(sys_errno); \
SET_REQ_LAST_ERROR(req, sys_errno);
void uv_fs_init() {
_fmode = _O_BINARY;
@ -227,8 +238,8 @@ void fs__open(uv_fs_t* req, const char* path, int flags, int mode) {
attributes,
NULL);
if (file == INVALID_HANDLE_VALUE) {
result = -1;
goto end;
SET_REQ_RESULT_WIN32_ERROR(req, GetLastError());
return;
}
result = _open_osfhandle((intptr_t)file, flags);
end:
@ -356,9 +367,8 @@ void fs__readdir(uv_fs_t* req, const char* path, int flags) {
free(path2);
if(dir == INVALID_HANDLE_VALUE) {
result = -1;
SET_REQ_LAST_ERROR(req, GetLastError());
goto done;
SET_REQ_RESULT_WIN32_ERROR(req, GetLastError());
return;
}
buf = (char*)malloc(buf_size);
@ -439,9 +449,10 @@ void fs__rename(uv_fs_t* req, const char* path, const char* new_path) {
void fs__fsync(uv_fs_t* req, uv_file file) {
int result = FlushFileBuffers((HANDLE)_get_osfhandle(file)) ? 0 : -1;
if (result == -1) {
SET_REQ_LAST_ERROR(req, GetLastError());
}
SET_REQ_RESULT_WIN32_ERROR(req, GetLastError());
} else {
SET_REQ_RESULT(req, result);
}
}
@ -560,9 +571,10 @@ void fs__futime(uv_fs_t* req, uv_file file, double atime, double mtime) {
void fs__link(uv_fs_t* req, const char* path, const char* new_path) {
int result = CreateHardLinkA(new_path, path, NULL) ? 0 : -1;
if (result == -1) {
SET_REQ_LAST_ERROR(req, GetLastError());
}
SET_REQ_RESULT_WIN32_ERROR(req, GetLastError());
} else {
SET_REQ_RESULT(req, result);
}
}
@ -589,7 +601,7 @@ void fs__readlink(uv_fs_t* req, const char* path) {
int result = -1;
BOOL rv;
HANDLE symlink;
void* buffer;
void* buffer = NULL;
DWORD bytes_returned;
REPARSE_DATA_BUFFER* reparse_data;
int utf8size;

11
deps/uv/src/win/winapi.h

@ -4069,11 +4069,14 @@
# define STATUS_HASH_NOT_PRESENT ((NTSTATUS) 0xC000A101L)
#endif
#ifndef NTSTATUS_FROM_WIN32
# define NTSTATUS_FROM_WIN32(error) ((NTSTATUS) (error) <= 0 ? \
((NTSTATUS) (error)) : ((NTSTATUS) (((error) & 0x0000FFFF) | \
(FACILITY_NTWIN32 << 16) | ERROR_SEVERITY_ERROR)))
/* This is not the NTSTATUS_FROM_WIN32 that the DDK provides, because the
/* DDK got it wrong! */
#ifdef NTSTATUS_FROM_WIN32
# undef NTSTATUS_FROM_WIN32
#endif
#define NTSTATUS_FROM_WIN32(error) ((NTSTATUS) (error) <= 0 ? \
((NTSTATUS) (error)) : ((NTSTATUS) (((error) & 0x0000FFFF) | \
(FACILITY_NTWIN32 << 16) | ERROR_SEVERITY_WARNING)))
/* from ntifs.h */
/* MinGW already has it */

2
deps/uv/test/test-fs.c

@ -391,7 +391,7 @@ TEST_IMPL(fs_file_noent) {
loop = uv_default_loop();
r = uv_fs_open(loop, &req, "does_not_exist", O_RDONLY, 0, NULL);
ASSERT(r == -1);
ASSERT(r == 0);
ASSERT(req.result == -1);
ASSERT(uv_last_error(loop).code == UV_ENOENT);
uv_fs_req_cleanup(&req);

Loading…
Cancel
Save