Skip to content

Commit b54da8a

Browse files
committed
Upgrade libuv to 1997e10b50
1 parent 5c3954a commit b54da8a

File tree

13 files changed

+70
-34
lines changed

13 files changed

+70
-34
lines changed

deps/uv/include/uv.h

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ UV_EXTERN void uv_pipe_open(uv_pipe_t*, uv_file file);
763763

764764
UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name);
765765

766-
UV_EXTERN int uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
766+
UV_EXTERN void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
767767
const char* name, uv_connect_cb cb);
768768

769769

@@ -1166,13 +1166,33 @@ struct uv_fs_event_s {
11661166
*/
11671167
UV_EXTERN void uv_loadavg(double avg[3]);
11681168

1169+
11691170
/*
1170-
* If filename is a directory then we will watch for all events in that
1171-
* directory. If filename is a file - we will only get events from that
1172-
* file. Subdirectories are not watched.
1173-
*/
1171+
* Flags to be passed to uv_fs_event_init.
1172+
*/
1173+
enum uv_fs_event_flags {
1174+
/*
1175+
* By default, if the fs event watcher is given a directory name, we will
1176+
* watch for all events in that directory. This flags overrides this behavior
1177+
* and makes fs_event report only changes to the directory entry itself. This
1178+
* flag does not affect individual files watched.
1179+
* This flag is currently not implemented yet on any backend.
1180+
*/
1181+
UV_FS_EVENT_WATCH_ENTRY = 1,
1182+
1183+
/*
1184+
* By default uv_fs_event will try to use a kernel interface such as inotify
1185+
* or kqueue to detect events. This may not work on remote filesystems such
1186+
* as NFS mounts. This flag makes fs_event fall back to calling stat() on a
1187+
* regular interval.
1188+
* This flag is currently not implemented yet on any backend.
1189+
*/
1190+
UV_FS_EVENT_STAT = 2
1191+
};
1192+
1193+
11741194
UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle,
1175-
const char* filename, uv_fs_event_cb cb);
1195+
const char* filename, uv_fs_event_cb cb, int flags);
11761196

11771197
/* Utility */
11781198

deps/uv/src/unix/cygwin.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ uint64_t uv_get_total_memory(void) {
6969
int uv_fs_event_init(uv_loop_t* loop,
7070
uv_fs_event_t* handle,
7171
const char* filename,
72-
uv_fs_event_cb cb) {
72+
uv_fs_event_cb cb,
73+
int flags) {
7374
uv__set_sys_error(loop, ENOSYS);
7475
return -1;
7576
}

deps/uv/src/unix/kqueue.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,13 @@ void uv__kqueue_hack(EV_P_ int fflags, ev_io *w) {
8686
int uv_fs_event_init(uv_loop_t* loop,
8787
uv_fs_event_t* handle,
8888
const char* filename,
89-
uv_fs_event_cb cb) {
89+
uv_fs_event_cb cb,
90+
int flags) {
9091
int fd;
9192

93+
/* We don't support any flags yet. */
94+
assert(!flags);
95+
9296
if (cb == NULL) {
9397
uv__set_sys_error(loop, EINVAL);
9498
return -1;
@@ -122,7 +126,8 @@ void uv__fs_event_destroy(uv_fs_event_t* handle) {
122126
int uv_fs_event_init(uv_loop_t* loop,
123127
uv_fs_event_t* handle,
124128
const char* filename,
125-
uv_fs_event_cb cb) {
129+
uv_fs_event_cb cb,
130+
int flags) {
126131
uv__set_sys_error(loop, ENOSYS);
127132
return -1;
128133
}

deps/uv/src/unix/linux.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,14 @@ static void uv__inotify_read(EV_P_ ev_io* w, int revents) {
156156
int uv_fs_event_init(uv_loop_t* loop,
157157
uv_fs_event_t* handle,
158158
const char* filename,
159-
uv_fs_event_cb cb) {
159+
uv_fs_event_cb cb,
160+
int flags) {
160161
int flags;
161162
int fd;
162163

164+
/* We don't support any flags yet. */
165+
assert(!flags);
166+
163167
/*
164168
* TODO share a single inotify fd across the event loop?
165169
* We'll run into fs.inotify.max_user_instances if we

deps/uv/src/unix/pipe.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void uv_pipe_open(uv_pipe_t* handle, uv_file fd) {
177177
}
178178

179179

180-
int uv_pipe_connect(uv_connect_t* req,
180+
void uv_pipe_connect(uv_connect_t* req,
181181
uv_pipe_t* handle,
182182
const char* name,
183183
uv_connect_cb cb) {
@@ -237,7 +237,6 @@ int uv_pipe_connect(uv_connect_t* req,
237237
* return 0 and let the callback handle errors.
238238
*/
239239
errno = saved_errno;
240-
return 0;
241240
}
242241

243242

deps/uv/src/unix/sunos.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,13 @@ static void uv__fs_event_read(EV_P_ ev_io* w, int revents) {
137137
int uv_fs_event_init(uv_loop_t* loop,
138138
uv_fs_event_t* handle,
139139
const char* filename,
140-
uv_fs_event_cb cb) {
140+
uv_fs_event_cb cb,
141+
int flags) {
141142
int portfd;
142143

144+
/* We don't support any flags yet. */
145+
assert(!flags);
146+
143147
if ((portfd = port_create()) == -1) {
144148
uv__set_sys_error(loop, errno);
145149
return -1;

deps/uv/src/win/fs-event.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,15 @@ static int uv_split_path(const wchar_t* filename, wchar_t** dir,
133133

134134

135135
int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle,
136-
const char* filename, uv_fs_event_cb cb) {
136+
const char* filename, uv_fs_event_cb cb, int flags) {
137137
int name_size;
138138
DWORD attr, last_error;
139139
wchar_t* dir = NULL, *dir_to_watch, *filenamew;
140140
wchar_t short_path[MAX_PATH];
141141

142+
/* We don't support any flags yet. */
143+
assert(!flags);
144+
142145
uv_fs_event_init_handle(loop, handle, filename, cb);
143146

144147
/* Convert name to UTF16. */

deps/uv/src/win/pipe.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ static DWORD WINAPI pipe_connect_thread_proc(void* parameter) {
443443
}
444444

445445

446-
int uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
446+
void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
447447
const char* name, uv_connect_cb cb) {
448448
uv_loop_t* loop = handle->loop;
449449
int errno, nameSize;
@@ -488,7 +488,7 @@ int uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
488488

489489
handle->reqs_pending++;
490490

491-
return 0;
491+
return;
492492
}
493493

494494
errno = GetLastError();
@@ -505,7 +505,7 @@ int uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
505505
SET_REQ_SUCCESS(req);
506506
uv_insert_pending_req(loop, (uv_req_t*) req);
507507
handle->reqs_pending++;
508-
return 0;
508+
return;
509509

510510
error:
511511
if (handle->name) {
@@ -516,8 +516,12 @@ int uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
516516
if (pipeHandle != INVALID_HANDLE_VALUE) {
517517
CloseHandle(pipeHandle);
518518
}
519-
uv__set_sys_error(loop, errno);
520-
return -1;
519+
520+
/* Make this req pending reporting an error. */
521+
SET_REQ_ERROR(req, errno);
522+
uv_insert_pending_req(loop, (uv_req_t*) req);
523+
handle->reqs_pending++;
524+
return;
521525
}
522526

523527

deps/uv/test/benchmark-pound.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,7 @@ static void pipe_make_connect(conn_rec* p) {
225225
r = uv_pipe_init(loop, (uv_pipe_t*)&p->stream, 0);
226226
ASSERT(r == 0);
227227

228-
r = uv_pipe_connect(&((pipe_conn_rec*)p)->conn_req, (uv_pipe_t*)&p->stream, TEST_PIPENAME, connect_cb);
229-
if (r) {
230-
fprintf(stderr, "uv_tcp_connect error %s\n",
231-
uv_err_name(uv_last_error(loop)));
232-
ASSERT(0);
233-
}
228+
uv_pipe_connect(&((pipe_conn_rec*)p)->conn_req, (uv_pipe_t*)&p->stream, TEST_PIPENAME, connect_cb);
234229

235230
#if DEBUG
236231
printf("make connect %d\n", p->i);

deps/uv/test/benchmark-pump.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,7 @@ static void maybe_connect_some() {
257257
ASSERT(r == 0);
258258

259259
req = (uv_connect_t*) req_alloc();
260-
r = uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb);
261-
ASSERT(r == 0);
260+
uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb);
262261
}
263262
}
264263
}

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ TEST_IMPL(fs_event_watch_dir) {
144144
uv_fs_rmdir(loop, &fs_req, "watch_dir", NULL);
145145
create_dir(loop, "watch_dir");
146146

147-
r = uv_fs_event_init(loop, &fs_event, "watch_dir", fs_event_cb_dir);
147+
r = uv_fs_event_init(loop, &fs_event, "watch_dir", fs_event_cb_dir, 0);
148148
ASSERT(r != -1);
149149
r = uv_timer_init(loop, &timer);
150150
ASSERT(r != -1);
@@ -178,7 +178,7 @@ TEST_IMPL(fs_event_watch_file) {
178178
create_file(loop, "watch_dir/file1");
179179
create_file(loop, "watch_dir/file2");
180180

181-
r = uv_fs_event_init(loop, &fs_event, "watch_dir/file2", fs_event_cb_file);
181+
r = uv_fs_event_init(loop, &fs_event, "watch_dir/file2", fs_event_cb_file, 0);
182182
ASSERT(r != -1);
183183
r = uv_timer_init(loop, &timer);
184184
ASSERT(r != -1);
@@ -212,7 +212,7 @@ TEST_IMPL(fs_event_watch_file_current_dir) {
212212
create_file(loop, "watch_file");
213213

214214
r = uv_fs_event_init(loop, &fs_event, "watch_file",
215-
fs_event_cb_file_current_dir);
215+
fs_event_cb_file_current_dir, 0);
216216
ASSERT(r != -1);
217217

218218
r = uv_timer_init(loop, &timer);
@@ -248,7 +248,11 @@ TEST_IMPL(fs_event_no_callback_on_close) {
248248
create_dir(loop, "watch_dir");
249249
create_file(loop, "watch_dir/file1");
250250

251-
r = uv_fs_event_init(loop, &fs_event, "watch_dir/file1", fs_event_cb_file);
251+
r = uv_fs_event_init(loop,
252+
&fs_event,
253+
"watch_dir/file1",
254+
fs_event_cb_file,
255+
0);
252256
ASSERT(r != -1);
253257

254258
uv_close((uv_handle_t*)&fs_event, close_cb);

deps/uv/test/test-ping-pong.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,8 @@ static void pipe_pinger_new() {
211211
/* We are never doing multiple reads/connects at a time anyway. */
212212
/* so these handles can be pre-initialized. */
213213

214-
r = uv_pipe_connect(&pinger->connect_req, &pinger->stream.pipe, TEST_PIPENAME,
214+
uv_pipe_connect(&pinger->connect_req, &pinger->stream.pipe, TEST_PIPENAME,
215215
pinger_on_connect);
216-
ASSERT(!r);
217216

218217
/* Synchronous connect callbacks are not allowed. */
219218
ASSERT(pinger_on_connect_count == 0);

deps/uv/test/test-pipe-connect-error.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ TEST_IMPL(pipe_connect_bad_name) {
5858
r = uv_pipe_init(uv_default_loop(), &client, 0);
5959
ASSERT(r == 0);
6060
uv_pipe_connect(&req, &client, BAD_PIPENAME, connect_cb);
61-
ASSERT(r == 0);
6261

6362
uv_run(uv_default_loop());
6463

0 commit comments

Comments
 (0)