Skip to content

Commit 21cc4c4

Browse files
committed
Upgrade libuv to ea4271f
Required adding uv_default_loop() in many places.
1 parent 6f60683 commit 21cc4c4

File tree

146 files changed

+2152
-1688
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+2152
-1688
lines changed

deps/uv/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ifdef MSVC
2424
uname_S := MINGW
2525
endif
2626

27-
CPPFLAGS += -Iinclude
27+
CPPFLAGS += -Iinclude -Iinclude/uv-private
2828

2929
CARES_OBJS =
3030
CARES_OBJS += src/ares/ares__close_sockets.o

deps/uv/config-unix.mk

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ AR = $(PREFIX)ar
2323
E=
2424
CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
2525
CFLAGS=-g
26-
CPPFLAGS += -Isrc/ev
26+
CPPFLAGS += -Isrc/unix/ev
2727
LINKFLAGS=-lm
2828

2929
CPPFLAGS += -D_LARGEFILE_SOURCE
@@ -34,15 +34,15 @@ EV_CONFIG=config_sunos.h
3434
EIO_CONFIG=config_sunos.h
3535
CPPFLAGS += -Isrc/ares/config_sunos -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
3636
LINKFLAGS+=-lsocket -lnsl
37-
UV_OS_FILE=uv-sunos.c
37+
UV_OS_FILE=sunos.c
3838
endif
3939

4040
ifeq (Darwin,$(uname_S))
4141
EV_CONFIG=config_darwin.h
4242
EIO_CONFIG=config_darwin.h
4343
CPPFLAGS += -Isrc/ares/config_darwin
4444
LINKFLAGS+=-framework CoreServices
45-
UV_OS_FILE=uv-darwin.c
45+
UV_OS_FILE=darwin.c
4646
endif
4747

4848
ifeq (Linux,$(uname_S))
@@ -51,15 +51,15 @@ EIO_CONFIG=config_linux.h
5151
CSTDFLAG += -D_XOPEN_SOURCE=600
5252
CPPFLAGS += -Isrc/ares/config_linux
5353
LINKFLAGS+=-lrt
54-
UV_OS_FILE=uv-linux.c
54+
UV_OS_FILE=linux.c
5555
endif
5656

5757
ifeq (FreeBSD,$(uname_S))
5858
EV_CONFIG=config_freebsd.h
5959
EIO_CONFIG=config_freebsd.h
6060
CPPFLAGS += -Isrc/ares/config_freebsd
6161
LINKFLAGS+=
62-
UV_OS_FILE=uv-freebsd.c
62+
UV_OS_FILE=freebsd.c
6363
endif
6464

6565
ifneq (,$(findstring CYGWIN,$(uname_S)))
@@ -69,7 +69,7 @@ EIO_CONFIG=config_cygwin.h
6969
CSTDFLAG = -D_GNU_SOURCE
7070
CPPFLAGS += -Isrc/ares/config_cygwin
7171
LINKFLAGS+=
72-
UV_OS_FILE=uv-cygwin.c
72+
UV_OS_FILE=cygwin.c
7373
endif
7474

7575
# Need _GNU_SOURCE for strdup?
@@ -85,46 +85,48 @@ endif
8585
RUNNER_LIBS=
8686
RUNNER_SRC=test/runner-unix.c
8787

88-
uv.a: src/uv-unix.o src/unix/fs.o src/uv-common.o src/uv-platform.o src/ev/ev.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
89-
$(AR) rcs uv.a src/uv-unix.o src/unix/fs.o src/uv-platform.o src/uv-common.o src/uv-eio.o src/ev/ev.o \
90-
src/eio/eio.o $(CARES_OBJS)
88+
uv.a: src/uv-unix.o src/unix/fs.o src/uv-common.o src/uv-platform.o src/unix/ev/ev.o src/unix/uv-eio.o src/unix/eio/eio.o $(CARES_OBJS)
89+
$(AR) rcs uv.a src/uv-unix.o src/unix/fs.o src/uv-platform.o src/uv-common.o src/unix/uv-eio.o src/unix/ev/ev.o \
90+
src/unix/eio/eio.o $(CARES_OBJS)
9191

92-
src/uv-platform.o: src/$(UV_OS_FILE) include/uv.h include/uv-unix.h
93-
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/$(UV_OS_FILE) -o src/uv-platform.o
92+
src/uv-platform.o: src/unix/$(UV_OS_FILE) include/uv.h include/uv-private/uv-unix.h
93+
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/unix/$(UV_OS_FILE) -o src/uv-platform.o
9494

95-
src/uv-unix.o: src/uv-unix.c include/uv.h include/uv-unix.h src/unix/internal.h
95+
src/uv-unix.o: src/uv-unix.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h
9696
$(CC) $(CSTDFLAG) $(CPPFLAGS) -Isrc $(CFLAGS) -c src/uv-unix.c -o src/uv-unix.o
9797

98-
src/unix/fs.o: src/unix/fs.c include/uv.h include/uv-unix.h src/unix/internal.h
98+
src/unix/fs.o: src/unix/fs.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h
9999
$(CC) $(CSTDFLAG) $(CPPFLAGS) -Isrc/ $(CFLAGS) -c src/unix/fs.c -o src/unix/fs.o
100100

101-
src/uv-common.o: src/uv-common.c include/uv.h include/uv-unix.h
101+
src/uv-common.o: src/uv-common.c include/uv.h include/uv-private/uv-unix.h
102102
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/uv-common.c -o src/uv-common.o
103103

104-
src/ev/ev.o: src/ev/ev.c
105-
$(CC) $(CPPFLAGS) $(CFLAGS) -c src/ev/ev.c -o src/ev/ev.o -DEV_CONFIG_H=\"$(EV_CONFIG)\"
104+
src/unix/ev/ev.o: src/unix/ev/ev.c
105+
$(CC) $(CPPFLAGS) $(CFLAGS) -c src/unix/ev/ev.c -o src/unix/ev/ev.o -DEV_CONFIG_H=\"$(EV_CONFIG)\"
106106

107107

108108
EIO_CPPFLAGS += $(CPPFLAGS)
109109
EIO_CPPFLAGS += -DEIO_CONFIG_H=\"$(EIO_CONFIG)\"
110110
EIO_CPPFLAGS += -DEIO_STACKSIZE=262144
111111
EIO_CPPFLAGS += -D_GNU_SOURCE
112112

113-
src/eio/eio.o: src/eio/eio.c
114-
$(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c src/eio/eio.c -o src/eio/eio.o
113+
src/unix/eio/eio.o: src/unix/eio/eio.c
114+
$(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c src/unix/eio/eio.c -o src/unix/eio/eio.o
115115

116-
src/uv-eio.o: src/uv-eio.c
117-
$(CC) $(CPPFLAGS) -Isrc/eio/ $(CSTDFLAG) $(CFLAGS) -c src/uv-eio.c -o src/uv-eio.o
116+
src/unix/uv-eio.o: src/unix/uv-eio.c
117+
$(CC) $(CPPFLAGS) -Isrc/unix/eio/ $(CSTDFLAG) $(CFLAGS) -c src/unix/uv-eio.c -o src/unix/uv-eio.o
118118

119119

120120
clean-platform:
121121
-rm -f src/ares/*.o
122-
-rm -f src/ev/*.o
123-
-rm -f src/eio/*.o
122+
-rm -f src/unix/ev/*.o
123+
-rm -f src/unix/eio/*.o
124+
-rm -f src/unix/*.o
124125
-rm -rf test/run-tests.dSYM run-benchmarks.dSYM
125126

126127
distclean-platform:
127128
-rm -f src/ares/*.o
128-
-rm -f src/ev/*.o
129-
-rm -f src/eio/*.o
129+
-rm -f src/unix/ev/*.o
130+
-rm -f src/unix/*.o
131+
-rm -f src/unix/eio/*.o
130132
-rm -rf test/run-tests.dSYM run-benchmarks.dSYM
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,15 @@ enum
195195
enum
196196
{
197197
EIO_MCL_CURRENT = 1,
198-
EIO_MCL_FUTURE = 2,
198+
EIO_MCL_FUTURE = 2
199199
};
200200

201201
/* request priorities */
202202

203203
enum {
204204
EIO_PRI_MIN = -4,
205205
EIO_PRI_MAX = 4,
206-
EIO_PRI_DEFAULT = 0,
206+
EIO_PRI_DEFAULT = 0
207207
};
208208

209209
/* eio request structure */
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ typedef struct {
4242

4343
typedef int uv_file;
4444

45+
#define UV_LOOP_PRIVATE_FIELDS \
46+
ares_channel channel; \
47+
/* \
48+
* While the channel is active this timer is called once per second to be \
49+
* sure that we're always calling ares_process. See the warning above the \
50+
* definition of ares_timeout(). \
51+
*/ \
52+
ev_timer timer; \
53+
struct ev_loop* ev;
54+
4555
#define UV_REQ_BUFSML_SIZE (4)
4656

4757
#define UV_REQ_PRIVATE_FIELDS /* empty */
Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,40 @@ typedef struct uv_buf_t {
4444

4545
typedef int uv_file;
4646

47+
RB_HEAD(uv_timer_tree_s, uv_timer_s);
48+
49+
#define UV_LOOP_PRIVATE_FIELDS \
50+
/* The loop's I/O completion port */ \
51+
HANDLE iocp; \
52+
/* Reference count that keeps the event loop alive */ \
53+
int refs; \
54+
/* The current time according to the event loop. in msecs. */ \
55+
int64_t time; \
56+
/* Tail of a single-linked circular queue of pending reqs. If the queue */ \
57+
/* is empty, tail_ is NULL. If there is only one item, */ \
58+
/* tail_->next_req == tail_ */ \
59+
uv_req_t* pending_reqs_tail; \
60+
/* Head of a single-linked list of closed handles */ \
61+
uv_handle_t* endgame_handles; \
62+
/* The head of the timers tree */ \
63+
struct uv_timer_tree_s timers; \
64+
/* Lists of active loop (prepare / check / idle) watchers */ \
65+
uv_prepare_t* prepare_handles; \
66+
uv_check_t* check_handles; \
67+
uv_idle_t* idle_handles; \
68+
/* This pointer will refer to the prepare/check/idle handle whose */ \
69+
/* callback is scheduled to be called next. This is needed to allow */ \
70+
/* safe removal from one of the lists above while that list being */ \
71+
/* iterated over. */ \
72+
uv_prepare_t* next_prepare_handle; \
73+
uv_check_t* next_check_handle; \
74+
uv_idle_t* next_idle_handle; \
75+
ares_channel ares_channel; \
76+
int ares_active_sockets; \
77+
uv_timer_t ares_polling_timer; \
78+
/* Last error code */ \
79+
uv_err_t last_error;
80+
4781
#define UV_REQ_TYPE_PRIVATE \
4882
/* TODO: remove the req suffix */ \
4983
UV_ARES_EVENT_REQ, \
@@ -227,5 +261,7 @@ typedef int uv_file;
227261

228262
#define UV_WORK_PRIVATE_FIELDS \
229263

230-
int uv_utf16_to_utf8(const wchar_t* utf16Buffer, size_t utf16Size, char* utf8Buffer, size_t utf8Size);
231-
int uv_utf8_to_utf16(const char* utf8Buffer, wchar_t* utf16Buffer, size_t utf16Size);
264+
int uv_utf16_to_utf8(const wchar_t* utf16Buffer, size_t utf16Size,
265+
char* utf8Buffer, size_t utf8Size);
266+
int uv_utf8_to_utf16(const char* utf8Buffer, wchar_t* utf16Buffer,
267+
size_t utf16Size);

0 commit comments

Comments
 (0)