Skip to content

Commit fb7faef

Browse files
committed
Upgrade libuv to d358738
1 parent 2c11718 commit fb7faef

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

deps/uv/config-unix.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ endif
7575
# Need _GNU_SOURCE for strdup?
7676
RUNNER_CFLAGS=$(CFLAGS) -D_GNU_SOURCE
7777

78-
RUNNER_LINKFLAGS=$(LINKFLAGS) -pthread
78+
RUNNER_LINKFLAGS=$(LINKFLAGS) -pthreads
7979
RUNNER_LIBS=
8080
RUNNER_SRC=test/runner-unix.c
8181

deps/uv/src/uv-unix.c

+23-5
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,9 @@ static void uv__drain(uv_stream_t* stream) {
647647
ev_io_stop(EV_DEFAULT_ &stream->write_watcher);
648648

649649
/* Shutdown? */
650-
if ((((uv_handle_t*)stream)->flags & UV_SHUTTING) &&
651-
!(((uv_handle_t*)stream)->flags & UV_CLOSING) &&
652-
!(((uv_handle_t*)stream)->flags & UV_SHUT)) {
650+
if ((stream->flags & UV_SHUTTING) &&
651+
!(stream->flags & UV_CLOSING) &&
652+
!(stream->flags & UV_SHUT)) {
653653
assert(stream->shutdown_req);
654654

655655
req = stream->shutdown_req;
@@ -2193,6 +2193,9 @@ static void uv__chld(EV_P_ ev_child* watcher, int revents) {
21932193
}
21942194
}
21952195

2196+
#ifndef SPAWN_WAIT_EXEC
2197+
# define SPAWN_WAIT_EXEC 1
2198+
#endif
21962199

21972200
int uv_spawn(uv_process_t* process, uv_process_options_t options) {
21982201
/*
@@ -2203,8 +2206,10 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
22032206
int stdin_pipe[2] = { -1, -1 };
22042207
int stdout_pipe[2] = { -1, -1 };
22052208
int stderr_pipe[2] = { -1, -1 };
2209+
#if SPAWN_WAIT_EXEC
22062210
int signal_pipe[2] = { -1, -1 };
22072211
struct pollfd pfd;
2212+
#endif
22082213
int status;
22092214
pid_t pid;
22102215

@@ -2222,6 +2227,8 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
22222227
if (pipe(stdin_pipe) < 0) {
22232228
goto error;
22242229
}
2230+
uv__cloexec(stdin_pipe[0], 1);
2231+
uv__cloexec(stdin_pipe[1], 1);
22252232
}
22262233

22272234
if (options.stdout_stream) {
@@ -2233,6 +2240,8 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
22332240
if (pipe(stdout_pipe) < 0) {
22342241
goto error;
22352242
}
2243+
uv__cloexec(stdout_pipe[0], 1);
2244+
uv__cloexec(stdout_pipe[1], 1);
22362245
}
22372246

22382247
if (options.stderr_stream) {
@@ -2244,6 +2253,8 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
22442253
if (pipe(stderr_pipe) < 0) {
22452254
goto error;
22462255
}
2256+
uv__cloexec(stderr_pipe[0], 1);
2257+
uv__cloexec(stderr_pipe[1], 1);
22472258
}
22482259

22492260
/* This pipe is used by the parent to wait until
@@ -2266,25 +2277,29 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
22662277
* marked close-on-exec. Then, after the call to `fork()`,
22672278
* the parent polls the read end until it sees POLLHUP.
22682279
*/
2269-
#ifdef HAVE_PIPE2
2280+
#if SPAWN_WAIT_EXEC
2281+
# ifdef HAVE_PIPE2
22702282
if (pipe2(signal_pipe, O_CLOEXEC | O_NONBLOCK) < 0) {
22712283
goto error;
22722284
}
2273-
#else
2285+
# else
22742286
if (pipe(signal_pipe) < 0) {
22752287
goto error;
22762288
}
22772289
uv__cloexec(signal_pipe[0], 1);
22782290
uv__cloexec(signal_pipe[1], 1);
22792291
uv__nonblock(signal_pipe[0], 1);
22802292
uv__nonblock(signal_pipe[1], 1);
2293+
# endif
22812294
#endif
22822295

22832296
pid = fork();
22842297

22852298
if (pid == -1) {
2299+
#if SPAWN_WAIT_EXEC
22862300
uv__close(signal_pipe[0]);
22872301
uv__close(signal_pipe[1]);
2302+
#endif
22882303
environ = save_our_env;
22892304
goto error;
22902305
}
@@ -2323,6 +2338,7 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
23232338
/* Restore environment. */
23242339
environ = save_our_env;
23252340

2341+
#if SPAWN_WAIT_EXEC
23262342
/* POLLHUP signals child has exited or execve()'d. */
23272343
uv__close(signal_pipe[1]);
23282344
do {
@@ -2334,11 +2350,13 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
23342350
while (status == -1 && (errno == EINTR || errno == ENOMEM));
23352351

23362352
uv__close(signal_pipe[0]);
2353+
uv__close(signal_pipe[1]);
23372354

23382355
assert((status == 1)
23392356
&& "poll() on pipe read end failed");
23402357
assert((pfd.revents & POLLHUP) == POLLHUP
23412358
&& "no POLLHUP on pipe read end");
2359+
#endif
23422360

23432361
process->pid = pid;
23442362

deps/uv/test/benchmark-pound.c

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/* Update this is you're going to run > 1000 concurrent requests. */
2626
#define MAX_CONNS 1000
2727

28+
#undef NANOSEC
2829
#define NANOSEC ((uint64_t)10e8)
2930

3031
/* Base class for tcp_conn_rec and pipe_conn_rec.

0 commit comments

Comments
 (0)