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

Commit

Permalink
Upgrade libuv to 142a702
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Sep 4, 2011
1 parent 3742aee commit 17021ea
Show file tree
Hide file tree
Showing 12 changed files with 621 additions and 69 deletions.
102 changes: 51 additions & 51 deletions deps/uv/common.gypi
@@ -1,5 +1,6 @@
{
'variables': {
'visibility%': 'hidden', # V8's visibility setting
'target_arch%': 'ia32', # set v8's target architecture
'host_arch%': 'ia32', # set v8's host architecture
'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
Expand Down Expand Up @@ -87,6 +88,11 @@
'DataExecutionPrevention': 2, # enable DEP
'AllowIsolation': 'true',
'SuppressStartupBanner': 'true',
'target_conditions': [
['_type=="executable"', {
'SubSystem': 1, # console executable
}],
],
},
},
'conditions': [
Expand All @@ -103,61 +109,55 @@
],
}],
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
'target_defaults': {
'cflags': [ '-Wall', '-pthread', '-fno-rtti', '-fno-exceptions' ],
'ldflags': [ '-pthread', ],
'conditions': [
[ 'target_arch=="ia32"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
[ 'OS=="linux"', {
'cflags': [ '-ansi' ],
}],
[ 'visibility=="hidden"', {
'cflags': [ '-fvisibility=hidden' ],
}],
],
},
'cflags': [ '-Wall', '-pthread', ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
'ldflags': [ '-pthread', ],
'conditions': [
[ 'target_arch=="ia32"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
[ 'OS=="linux"', {
'cflags': [ '-ansi' ],
}],
[ 'visibility=="hidden"', {
'cflags': [ '-fvisibility=hidden' ],
}],
],
}],
['OS=="mac"', {
'target_defaults': {
'xcode_settings': {
'ALWAYS_SEARCH_USER_PATHS': 'NO',
'GCC_C_LANGUAGE_STANDARD': 'ansi', # -ansi
'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
# (Equivalent to -fPIC)
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
# GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', # -Werror
'GCC_VERSION': '4.2',
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4
'PREBINDING': 'NO', # No -Wl,-prebind
'USE_HEADERMAP': 'NO',
'OTHER_CFLAGS': [
'-fno-strict-aliasing',
],
'WARNING_CFLAGS': [
'-Wall',
'-Wendif-labels',
'-W',
'-Wno-unused-parameter',
'-Wnon-virtual-dtor',
],
},
'target_conditions': [
['_type!="static_library"', {
'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
}],
'xcode_settings': {
'ALWAYS_SEARCH_USER_PATHS': 'NO',
'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
# (Equivalent to -fPIC)
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
# GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
'GCC_VERSION': '4.2',
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4
'PREBINDING': 'NO', # No -Wl,-prebind
'USE_HEADERMAP': 'NO',
'OTHER_CFLAGS': [
'-fno-strict-aliasing',
],
'WARNING_CFLAGS': [
'-Wall',
'-Wendif-labels',
'-W',
'-Wno-unused-parameter',
],
},
'target_conditions': [
['_type!="static_library"', {
'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
}],
],
}],
],
},
Expand Down
1 change: 1 addition & 0 deletions deps/uv/include/uv-private/uv-win.h
Expand Up @@ -247,6 +247,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);

#define UV_FS_PRIVATE_FIELDS \
int flags; \
int last_error; \
struct _stat stat; \
void* arg0; \
union { \
Expand Down
8 changes: 7 additions & 1 deletion deps/uv/include/uv.h
Expand Up @@ -948,8 +948,14 @@ int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb);
int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path,
const char* new_path, uv_fs_cb cb);

/*
* This flag can be used with uv_fs_symlink on Windows
* to specify whether path argument points to a directory.
*/
#define UV_FS_SYMLINK_DIR 0x0001

int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
const char* new_path, uv_fs_cb cb);
const char* new_path, int flags, uv_fs_cb cb);

int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_cb cb);
Expand Down
1 change: 0 additions & 1 deletion deps/uv/src/unix/core.c
Expand Up @@ -323,7 +323,6 @@ int64_t uv_now(uv_loop_t* loop) {
void uv__req_init(uv_req_t* req) {
/* loop->counters.req_init++; */
req->type = UV_UNKNOWN_REQ;
req->data = NULL;
}


Expand Down
1 change: 1 addition & 0 deletions deps/uv/src/unix/darwin.c
Expand Up @@ -24,6 +24,7 @@
#include <CoreServices/CoreServices.h>
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <mach-o/dyld.h> /* _NSGetExecutablePath */


uint64_t uv_hrtime() {
Expand Down
74 changes: 70 additions & 4 deletions deps/uv/src/unix/fs.c
Expand Up @@ -112,7 +112,7 @@ static int uv__fs_after(eio_req* eio) {
case UV_FS_READDIR:
/*
* XXX This is pretty bad.
* We alloc and copy the large null termiated string list from libeio.
* We alloc and copy the large null terminated string list from libeio.
* This is done because libeio is going to free eio->ptr2 after this
* callback. We must keep it until uv_fs_req_cleanup. If we get rid of
* libeio this can be avoided.
Expand All @@ -130,12 +130,31 @@ static int uv__fs_after(eio_req* eio) {
req->ptr = malloc(buflen);
memcpy(req->ptr, req->eio->ptr2, buflen);
break;

case UV_FS_STAT:
case UV_FS_LSTAT:
case UV_FS_FSTAT:
req->ptr = req->eio->ptr2;
break;

case UV_FS_READLINK:
if (req->result == -1) {
req->ptr = NULL;
} else {
assert(req->result > 0);

if ((name = realloc(req->eio->ptr2, req->result + 1)) == NULL) {
/* Not enough memory. Reuse buffer, chop off last byte. */
name = req->eio->ptr2;
req->result--;
}

name[req->result] = '\0';
req->ptr = name;
req->result = 0;
}
break;

default:
break;
}
Expand Down Expand Up @@ -490,15 +509,62 @@ int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path,


int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
const char* new_path, uv_fs_cb cb) {
const char* new_path, int flags, uv_fs_cb cb) {
WRAP_EIO(UV_FS_SYMLINK, eio_symlink, symlink, ARGS2(path, new_path))
}


int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_cb cb) {
assert(0 && "implement me");
return -1;
size_t size;
int status;
char* buf;

status = -1;

uv_fs_req_init(loop, req, UV_FS_READLINK, cb);

if (cb) {
if ((req->eio = eio_readlink(path, EIO_PRI_DEFAULT, uv__fs_after, req))) {
uv_ref(loop);
return 0;
} else {
uv_err_new(loop, ENOMEM);
return -1;
}
} else {
/* pathconf(_PC_PATH_MAX) may return -1 to signify that path
* lengths have no upper limit or aren't suitable for malloc'ing.
*/
if ((size = pathconf(path, _PC_PATH_MAX)) == -1) {
#if defined(PATH_MAX)
size = PATH_MAX;
#else
size = 4096;
#endif
}

if ((buf = malloc(size + 1)) == NULL) {
uv_err_new(loop, ENOMEM);
return -1;
}

if ((size = readlink(path, buf, size)) == -1) {
req->errorno = errno;
req->result = -1;
free(buf);
} else {
/* Cannot conceivably fail since it shrinks the buffer. */
buf = realloc(buf, size + 1);
buf[size] = '\0';
req->result = 0;
req->ptr = buf;
}

return 0;
}

assert(0 && "unreachable");
}


Expand Down

0 comments on commit 17021ea

Please sign in to comment.