Skip to content

Commit 17021ea

Browse files
committed
Upgrade libuv to 142a702
1 parent 3742aee commit 17021ea

File tree

12 files changed

+621
-69
lines changed

12 files changed

+621
-69
lines changed

deps/uv/common.gypi

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
'variables': {
3+
'visibility%': 'hidden', # V8's visibility setting
34
'target_arch%': 'ia32', # set v8's target architecture
45
'host_arch%': 'ia32', # set v8's host architecture
56
'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
@@ -87,6 +88,11 @@
8788
'DataExecutionPrevention': 2, # enable DEP
8889
'AllowIsolation': 'true',
8990
'SuppressStartupBanner': 'true',
91+
'target_conditions': [
92+
['_type=="executable"', {
93+
'SubSystem': 1, # console executable
94+
}],
95+
],
9096
},
9197
},
9298
'conditions': [
@@ -103,61 +109,55 @@
103109
],
104110
}],
105111
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
106-
'target_defaults': {
107-
'cflags': [ '-Wall', '-pthread', '-fno-rtti', '-fno-exceptions' ],
108-
'ldflags': [ '-pthread', ],
109-
'conditions': [
110-
[ 'target_arch=="ia32"', {
111-
'cflags': [ '-m32' ],
112-
'ldflags': [ '-m32' ],
113-
}],
114-
[ 'OS=="linux"', {
115-
'cflags': [ '-ansi' ],
116-
}],
117-
[ 'visibility=="hidden"', {
118-
'cflags': [ '-fvisibility=hidden' ],
119-
}],
120-
],
121-
},
112+
'cflags': [ '-Wall', '-pthread', ],
113+
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
114+
'ldflags': [ '-pthread', ],
115+
'conditions': [
116+
[ 'target_arch=="ia32"', {
117+
'cflags': [ '-m32' ],
118+
'ldflags': [ '-m32' ],
119+
}],
120+
[ 'OS=="linux"', {
121+
'cflags': [ '-ansi' ],
122+
}],
123+
[ 'visibility=="hidden"', {
124+
'cflags': [ '-fvisibility=hidden' ],
125+
}],
126+
],
122127
}],
123128
['OS=="mac"', {
124-
'target_defaults': {
125-
'xcode_settings': {
126-
'ALWAYS_SEARCH_USER_PATHS': 'NO',
127-
'GCC_C_LANGUAGE_STANDARD': 'ansi', # -ansi
128-
'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
129-
'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
130-
# (Equivalent to -fPIC)
131-
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
132-
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
133-
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
134-
# GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
135-
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
136-
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
137-
'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
138-
'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', # -Werror
139-
'GCC_VERSION': '4.2',
140-
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
141-
'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4
142-
'PREBINDING': 'NO', # No -Wl,-prebind
143-
'USE_HEADERMAP': 'NO',
144-
'OTHER_CFLAGS': [
145-
'-fno-strict-aliasing',
146-
],
147-
'WARNING_CFLAGS': [
148-
'-Wall',
149-
'-Wendif-labels',
150-
'-W',
151-
'-Wno-unused-parameter',
152-
'-Wnon-virtual-dtor',
153-
],
154-
},
155-
'target_conditions': [
156-
['_type!="static_library"', {
157-
'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
158-
}],
129+
'xcode_settings': {
130+
'ALWAYS_SEARCH_USER_PATHS': 'NO',
131+
'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
132+
'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
133+
# (Equivalent to -fPIC)
134+
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
135+
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
136+
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
137+
# GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
138+
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
139+
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
140+
'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
141+
'GCC_VERSION': '4.2',
142+
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
143+
'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4
144+
'PREBINDING': 'NO', # No -Wl,-prebind
145+
'USE_HEADERMAP': 'NO',
146+
'OTHER_CFLAGS': [
147+
'-fno-strict-aliasing',
148+
],
149+
'WARNING_CFLAGS': [
150+
'-Wall',
151+
'-Wendif-labels',
152+
'-W',
153+
'-Wno-unused-parameter',
159154
],
160155
},
156+
'target_conditions': [
157+
['_type!="static_library"', {
158+
'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
159+
}],
160+
],
161161
}],
162162
],
163163
},

deps/uv/include/uv-private/uv-win.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
247247

248248
#define UV_FS_PRIVATE_FIELDS \
249249
int flags; \
250+
int last_error; \
250251
struct _stat stat; \
251252
void* arg0; \
252253
union { \

deps/uv/include/uv.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,8 +948,14 @@ int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb);
948948
int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path,
949949
const char* new_path, uv_fs_cb cb);
950950

951+
/*
952+
* This flag can be used with uv_fs_symlink on Windows
953+
* to specify whether path argument points to a directory.
954+
*/
955+
#define UV_FS_SYMLINK_DIR 0x0001
956+
951957
int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
952-
const char* new_path, uv_fs_cb cb);
958+
const char* new_path, int flags, uv_fs_cb cb);
953959

954960
int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
955961
uv_fs_cb cb);

deps/uv/src/unix/core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ int64_t uv_now(uv_loop_t* loop) {
323323
void uv__req_init(uv_req_t* req) {
324324
/* loop->counters.req_init++; */
325325
req->type = UV_UNKNOWN_REQ;
326-
req->data = NULL;
327326
}
328327

329328

deps/uv/src/unix/darwin.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <CoreServices/CoreServices.h>
2525
#include <mach/mach.h>
2626
#include <mach/mach_time.h>
27+
#include <mach-o/dyld.h> /* _NSGetExecutablePath */
2728

2829

2930
uint64_t uv_hrtime() {

deps/uv/src/unix/fs.c

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static int uv__fs_after(eio_req* eio) {
112112
case UV_FS_READDIR:
113113
/*
114114
* XXX This is pretty bad.
115-
* We alloc and copy the large null termiated string list from libeio.
115+
* We alloc and copy the large null terminated string list from libeio.
116116
* This is done because libeio is going to free eio->ptr2 after this
117117
* callback. We must keep it until uv_fs_req_cleanup. If we get rid of
118118
* libeio this can be avoided.
@@ -130,12 +130,31 @@ static int uv__fs_after(eio_req* eio) {
130130
req->ptr = malloc(buflen);
131131
memcpy(req->ptr, req->eio->ptr2, buflen);
132132
break;
133+
133134
case UV_FS_STAT:
134135
case UV_FS_LSTAT:
135136
case UV_FS_FSTAT:
136137
req->ptr = req->eio->ptr2;
137138
break;
138139

140+
case UV_FS_READLINK:
141+
if (req->result == -1) {
142+
req->ptr = NULL;
143+
} else {
144+
assert(req->result > 0);
145+
146+
if ((name = realloc(req->eio->ptr2, req->result + 1)) == NULL) {
147+
/* Not enough memory. Reuse buffer, chop off last byte. */
148+
name = req->eio->ptr2;
149+
req->result--;
150+
}
151+
152+
name[req->result] = '\0';
153+
req->ptr = name;
154+
req->result = 0;
155+
}
156+
break;
157+
139158
default:
140159
break;
141160
}
@@ -490,15 +509,62 @@ int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path,
490509

491510

492511
int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
493-
const char* new_path, uv_fs_cb cb) {
512+
const char* new_path, int flags, uv_fs_cb cb) {
494513
WRAP_EIO(UV_FS_SYMLINK, eio_symlink, symlink, ARGS2(path, new_path))
495514
}
496515

497516

498517
int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
499518
uv_fs_cb cb) {
500-
assert(0 && "implement me");
501-
return -1;
519+
size_t size;
520+
int status;
521+
char* buf;
522+
523+
status = -1;
524+
525+
uv_fs_req_init(loop, req, UV_FS_READLINK, cb);
526+
527+
if (cb) {
528+
if ((req->eio = eio_readlink(path, EIO_PRI_DEFAULT, uv__fs_after, req))) {
529+
uv_ref(loop);
530+
return 0;
531+
} else {
532+
uv_err_new(loop, ENOMEM);
533+
return -1;
534+
}
535+
} else {
536+
/* pathconf(_PC_PATH_MAX) may return -1 to signify that path
537+
* lengths have no upper limit or aren't suitable for malloc'ing.
538+
*/
539+
if ((size = pathconf(path, _PC_PATH_MAX)) == -1) {
540+
#if defined(PATH_MAX)
541+
size = PATH_MAX;
542+
#else
543+
size = 4096;
544+
#endif
545+
}
546+
547+
if ((buf = malloc(size + 1)) == NULL) {
548+
uv_err_new(loop, ENOMEM);
549+
return -1;
550+
}
551+
552+
if ((size = readlink(path, buf, size)) == -1) {
553+
req->errorno = errno;
554+
req->result = -1;
555+
free(buf);
556+
} else {
557+
/* Cannot conceivably fail since it shrinks the buffer. */
558+
buf = realloc(buf, size + 1);
559+
buf[size] = '\0';
560+
req->result = 0;
561+
req->ptr = buf;
562+
}
563+
564+
return 0;
565+
}
566+
567+
assert(0 && "unreachable");
502568
}
503569

504570

0 commit comments

Comments
 (0)