Skip to content

Commit 4c87c1b

Browse files
cjihrigMylesBorins
authored andcommitted
deps: upgrade to libuv 1.28.0
Notable changes: - uv_gettimeofday() has been added. - Streaming readdir() via the uv_fs_{open,read,close}dir() methods. - A macOS copyfile() permissions bug has been fixed. - A bug in uv_interface_addresses() on machines with multiple interfaces has been fixed. Fixes: #27273 Backport-PR-URL: #27776 PR-URL: #27241 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 57eb6b2 commit 4c87c1b

28 files changed

+1192
-133
lines changed

deps/uv/AUTHORS

+5
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,8 @@ yeyuanfeng <[email protected]>
371371
372372
Thomas Karl Pietrowski <[email protected]>
373373
374+
Andreas Rohner <[email protected]>
375+
Rich Trott <[email protected]>
376+
Milad Farazmand <[email protected]>
377+
378+
Yury Selivanov <[email protected]>

deps/uv/CMakeLists.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ set(uv_test_sources
5353
test/test-fs-event.c
5454
test/test-fs-poll.c
5555
test/test-fs.c
56+
test/test-fs-readdir.c
5657
test/test-get-currentexe.c
5758
test/test-get-loadavg.c
5859
test/test-get-memory.c
@@ -62,6 +63,7 @@ set(uv_test_sources
6263
test/test-getnameinfo.c
6364
test/test-getsockname.c
6465
test/test-getters-setters.c
66+
test/test-gettimeofday.c
6567
test/test-handle-fileno.c
6668
test/test-homedir.c
6769
test/test-hrtime.c
@@ -262,7 +264,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
262264
src/unix/sysinfo-memory.c)
263265
endif()
264266

265-
if(CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|Linux|OS/390")
267+
if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "Android|Linux|OS/390")
266268
list(APPEND uv_sources src/unix/proctitle.c)
267269
endif()
268270

@@ -275,11 +277,11 @@ if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD")
275277
list(APPEND uv_libraries kvm)
276278
endif()
277279

278-
if(CMAKE_SYSTEM_NAME MATCHES "Darwin|DragonFly|FreeBSD|NetBSD|OpenBSD")
280+
if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD")
279281
list(APPEND uv_sources src/unix/bsd-ifaddrs.c src/unix/kqueue.c)
280282
endif()
281283

282-
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
284+
if(APPLE)
283285
list(APPEND uv_defines _DARWIN_UNLIMITED_SELECT=1 _DARWIN_USE_64_BIT_INODE=1)
284286
list(APPEND uv_sources
285287
src/unix/darwin-proctitle.c
@@ -333,7 +335,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
333335
list(APPEND uv_sources src/unix/no-proctitle.c src/unix/sunos.c)
334336
endif()
335337

336-
if(CMAKE_SYSTEM_NAME MATCHES "Darwin|DragonFly|FreeBSD|Linux|NetBSD|OpenBSD")
338+
if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD")
337339
list(APPEND uv_test_libraries util)
338340
endif()
339341

deps/uv/ChangeLog

+35
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
2019.04.16, Version 1.28.0 (Stable), 7bf8fabfa934660ee0fe889f78e151198a1165fc
2+
3+
Changes since version 1.27.0:
4+
5+
* unix,win: add uv_gettimeofday() (cjihrig)
6+
7+
* unix,win: add uv_fs_{open,read,close}dir() (cjihrig)
8+
9+
* unix: fix uv_interface_addresses() (Andreas Rohner)
10+
11+
* fs: remove macOS-specific copyfile(3) (Rich Trott)
12+
13+
* fs: add test for copyfile() respecting permissions (Rich Trott)
14+
15+
* build: partially revert 5234b1c43a (Ben Noordhuis)
16+
17+
* zos: fix setsockopt error when using AF_UNIX (Milad Farazmand)
18+
19+
* unix: suppress EINTR/EINPROGRESS in uv_fs_close() (Ben Noordhuis)
20+
21+
* build: use cmake APPLE variable to detect platform (zlargon)
22+
23+
* distcheck: remove duplicate test/ entry (Jameson Nash)
24+
25+
* unix: remove unused cmpxchgl() function (Ben Noordhuis)
26+
27+
* unix: support sockaddr_un in uv_udp_send() (Yury Selivanov)
28+
29+
* unix: guard use of PTHREAD_STACK_MIN (Kamil Rytarowski)
30+
31+
* unix,win: introduce uv_timeval64_t (cjihrig)
32+
33+
* doc: document uv_timeval_t and uv_timeval64_t (cjihrig)
34+
35+
136
2019.03.17, Version 1.27.0 (Stable), a4fc9a66cc35256dbc4dcd67c910174f05b6daa6
237

338
Changes since version 1.26.0:

deps/uv/Makefile.am

+2-9
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,10 @@ libuv_la_SOURCES = src/fs-poll.c \
4545
src/version.c
4646

4747
if SUNOS
48-
if GCC
4948
# Can't be turned into a CC_CHECK_CFLAGS in configure.ac, it makes compilers
5049
# on other platforms complain that the argument is unused during compilation.
5150
libuv_la_CFLAGS += -pthreads
5251
endif
53-
endif
5452

5553
if WINNT
5654

@@ -120,7 +118,6 @@ endif # WINNT
120118
EXTRA_DIST = test/fixtures/empty_file \
121119
test/fixtures/load_error.node \
122120
include \
123-
test \
124121
docs \
125122
img \
126123
samples \
@@ -143,20 +140,14 @@ check_PROGRAMS = test/run-tests
143140
if OS390
144141
test_run_tests_CFLAGS =
145142
else
146-
if GCC
147143
test_run_tests_CFLAGS = -Wno-long-long
148-
else
149-
test_run_tests_CFLAGS =
150-
endif
151144
endif
152145

153146
if SUNOS
154-
if GCC
155147
# Can't be turned into a CC_CHECK_CFLAGS in configure.ac, it makes compilers
156148
# on other platforms complain that the argument is unused during compilation.
157149
test_run_tests_CFLAGS += -pthreads
158150
endif
159-
endif
160151

161152
test_run_tests_LDFLAGS =
162153
test_run_tests_SOURCES = test/blackhole-server.c \
@@ -191,6 +182,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
191182
test/test-fs-event.c \
192183
test/test-fs-poll.c \
193184
test/test-fs.c \
185+
test/test-fs-readdir.c \
194186
test/test-fork.c \
195187
test/test-getters-setters.c \
196188
test/test-get-currentexe.c \
@@ -201,6 +193,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
201193
test/test-gethostname.c \
202194
test/test-getnameinfo.c \
203195
test/test-getsockname.c \
196+
test/test-gettimeofday.c \
204197
test/test-handle-fileno.c \
205198
test/test-homedir.c \
206199
test/test-hrtime.c \

deps/uv/configure.ac

+9-12
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1414

1515
AC_PREREQ(2.57)
16-
AC_INIT([libuv], [1.27.0], [https://github.com/libuv/libuv/issues])
16+
AC_INIT([libuv], [1.28.0], [https://github.com/libuv/libuv/issues])
1717
AC_CONFIG_MACRO_DIR([m4])
1818
m4_include([m4/libuv-extra-automake-flags.m4])
1919
m4_include([m4/as_case.m4])
@@ -24,18 +24,16 @@ AC_ENABLE_SHARED
2424
AC_ENABLE_STATIC
2525
AC_PROG_CC
2626
AM_PROG_CC_C_O
27+
AS_IF([AS_CASE([$host_os],[openedition*], [false], [true])], [
28+
CC_CHECK_CFLAGS_APPEND([-pedantic])
29+
])
2730
CC_FLAG_VISIBILITY #[-fvisibility=hidden]
2831
CC_CHECK_CFLAGS_APPEND([-g])
29-
AS_IF([test "x$GCC" = xyes], [
30-
AS_IF([AS_CASE([$host_os], [openedition*], [false], [true])], [
31-
CC_CHECK_CFLAGS_APPEND([-pedantic])
32-
])
33-
CC_CHECK_CFLAGS_APPEND([-std=gnu89])
34-
CC_CHECK_CFLAGS_APPEND([-Wall])
35-
CC_CHECK_CFLAGS_APPEND([-Wextra])
36-
CC_CHECK_CFLAGS_APPEND([-Wno-unused-parameter])
37-
CC_CHECK_CFLAGS_APPEND([-Wstrict-prototypes])
38-
])
32+
CC_CHECK_CFLAGS_APPEND([-std=gnu89])
33+
CC_CHECK_CFLAGS_APPEND([-Wall])
34+
CC_CHECK_CFLAGS_APPEND([-Wextra])
35+
CC_CHECK_CFLAGS_APPEND([-Wno-unused-parameter])
36+
CC_CHECK_CFLAGS_APPEND([-Wstrict-prototypes])
3937
# AM_PROG_AR is not available in automake v0.11 but it's essential in v0.12.
4038
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
4139
# autoconf complains if AC_PROG_LIBTOOL precedes AM_PROG_AR.
@@ -52,7 +50,6 @@ AC_CHECK_LIB([rt], [clock_gettime])
5250
AC_CHECK_LIB([sendfile], [sendfile])
5351
AC_CHECK_LIB([socket], [socket])
5452
AC_SYS_LARGEFILE
55-
AM_CONDITIONAL([GCC], [AS_IF([test "x$GCC" = xyes], [true], [false])])
5653
AM_CONDITIONAL([AIX], [AS_CASE([$host_os],[aix*], [true], [false])])
5754
AM_CONDITIONAL([ANDROID], [AS_CASE([$host_os],[linux-android*],[true], [false])])
5855
AM_CONDITIONAL([CYGWIN], [AS_CASE([$host_os],[cygwin*], [true], [false])])

deps/uv/docs/src/fs.rst

+58
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,21 @@ Data types
122122
uv_dirent_type_t type;
123123
} uv_dirent_t;
124124

125+
.. c:type:: uv_dir_t
126+
127+
Data type used for streaming directory iteration.
128+
Used by :c:func:`uv_fs_opendir()`, :c:func:`uv_fs_readdir()`, and
129+
:c:func:`uv_fs_closedir()`. `dirents` represents a user provided array of
130+
`uv_dirent_t`s used to hold results. `nentries` is the user provided maximum
131+
array size of `dirents`.
132+
133+
::
134+
135+
typedef struct uv_dir_s {
136+
uv_dirent_t* dirents;
137+
size_t nentries;
138+
} uv_dir_t;
139+
125140

126141
Public members
127142
^^^^^^^^^^^^^^
@@ -208,6 +223,49 @@ API
208223
209224
Equivalent to :man:`rmdir(2)`.
210225
226+
.. c:function:: int uv_fs_opendir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
227+
228+
Opens `path` as a directory stream. On success, a `uv_dir_t` is allocated
229+
and returned via `req->ptr`. This memory is not freed by
230+
`uv_fs_req_cleanup()`, although `req->ptr` is set to `NULL`. The allocated
231+
memory must be freed by calling `uv_fs_closedir()`. On failure, no memory
232+
is allocated.
233+
234+
The contents of the directory can be iterated over by passing the resulting
235+
`uv_dir_t` to `uv_fs_readdir()`.
236+
237+
.. versionadded:: 1.28.0
238+
239+
.. c:function:: int uv_fs_closedir(uv_loop_t* loop, uv_fs_t* req, uv_dir_t* dir, uv_fs_cb cb)
240+
241+
Closes the directory stream represented by `dir` and frees the memory
242+
allocated by `uv_fs_opendir()`.
243+
244+
.. versionadded:: 1.28.0
245+
246+
.. c:function:: int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, uv_dir_t* dir, uv_fs_cb cb)
247+
248+
Iterates over the directory stream, `dir`, returned by a successful
249+
`uv_fs_opendir()` call. Prior to invoking `uv_fs_readdir()`, the caller
250+
must set `dir->dirents` and `dir->nentries`, representing the array of
251+
:c:type:`uv_dirent_t` elements used to hold the read directory entries and
252+
its size.
253+
254+
On success, the result is an integer >= 0 representing the number of entries
255+
read from the stream.
256+
257+
.. versionadded:: 1.28.0
258+
259+
.. warning::
260+
`uv_fs_readdir()` is not thread safe.
261+
262+
.. note::
263+
This function does not return the "." and ".." entries.
264+
265+
.. note::
266+
On success this function allocates memory that must be freed using
267+
`uv_fs_req_cleanup()`.
268+
211269
.. c:function:: int uv_fs_scandir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, uv_fs_cb cb)
212270
.. c:function:: int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent)
213271

deps/uv/docs/src/misc.rst

+29
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,28 @@ Data types
6565

6666
.. versionadded:: 1.16.0
6767

68+
.. c:type:: uv_timeval_t
69+
70+
Data type for storing times.
71+
72+
::
73+
74+
typedef struct {
75+
long tv_sec;
76+
long tv_usec;
77+
} uv_timeval_t;
78+
79+
.. c:type:: uv_timeval64_t
80+
81+
Alternative data type for storing times.
82+
83+
::
84+
85+
typedef struct {
86+
int64_t tv_sec;
87+
int32_t tv_usec;
88+
} uv_timeval64_t;
89+
6890
.. c:type:: uv_rusage_t
6991
7092
Data type for resource usage results.
@@ -578,3 +600,10 @@ API
578600
zero on success, and a non-zero error value otherwise.
579601
580602
.. versionadded:: 1.25.0
603+
604+
.. c:function:: int uv_gettimeofday(uv_timeval64_t* tv)
605+
606+
Cross-platform implementation of :man:`gettimeofday(2)`. The timezone
607+
argument to `gettimeofday()` is not supported, as it is considered obsolete.
608+
609+
.. versionadded:: 1.28.0

deps/uv/include/uv.h

+31-1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ typedef enum {
202202
/* Handle types. */
203203
typedef struct uv_loop_s uv_loop_t;
204204
typedef struct uv_handle_s uv_handle_t;
205+
typedef struct uv_dir_s uv_dir_t;
205206
typedef struct uv_stream_s uv_stream_t;
206207
typedef struct uv_tcp_s uv_tcp_t;
207208
typedef struct uv_udp_s uv_udp_t;
@@ -1098,6 +1099,11 @@ typedef struct {
10981099
long tv_usec;
10991100
} uv_timeval_t;
11001101

1102+
typedef struct {
1103+
int64_t tv_sec;
1104+
int32_t tv_usec;
1105+
} uv_timeval64_t;
1106+
11011107
typedef struct {
11021108
uv_timeval_t ru_utime; /* user CPU time used */
11031109
uv_timeval_t ru_stime; /* system CPU time used */
@@ -1196,9 +1202,19 @@ typedef enum {
11961202
UV_FS_FCHOWN,
11971203
UV_FS_REALPATH,
11981204
UV_FS_COPYFILE,
1199-
UV_FS_LCHOWN
1205+
UV_FS_LCHOWN,
1206+
UV_FS_OPENDIR,
1207+
UV_FS_READDIR,
1208+
UV_FS_CLOSEDIR
12001209
} uv_fs_type;
12011210

1211+
struct uv_dir_s {
1212+
uv_dirent_t* dirents;
1213+
size_t nentries;
1214+
void* reserved[4];
1215+
UV_DIR_PRIVATE_FIELDS
1216+
};
1217+
12021218
/* uv_fs_t is a subclass of uv_req_t. */
12031219
struct uv_fs_s {
12041220
UV_REQ_FIELDS
@@ -1291,6 +1307,18 @@ UV_EXTERN int uv_fs_scandir(uv_loop_t* loop,
12911307
uv_fs_cb cb);
12921308
UV_EXTERN int uv_fs_scandir_next(uv_fs_t* req,
12931309
uv_dirent_t* ent);
1310+
UV_EXTERN int uv_fs_opendir(uv_loop_t* loop,
1311+
uv_fs_t* req,
1312+
const char* path,
1313+
uv_fs_cb cb);
1314+
UV_EXTERN int uv_fs_readdir(uv_loop_t* loop,
1315+
uv_fs_t* req,
1316+
uv_dir_t* dir,
1317+
uv_fs_cb cb);
1318+
UV_EXTERN int uv_fs_closedir(uv_loop_t* loop,
1319+
uv_fs_t* req,
1320+
uv_dir_t* dir,
1321+
uv_fs_cb cb);
12941322
UV_EXTERN int uv_fs_stat(uv_loop_t* loop,
12951323
uv_fs_t* req,
12961324
const char* path,
@@ -1586,6 +1614,8 @@ UV_EXTERN void uv_key_delete(uv_key_t* key);
15861614
UV_EXTERN void* uv_key_get(uv_key_t* key);
15871615
UV_EXTERN void uv_key_set(uv_key_t* key, void* value);
15881616

1617+
UV_EXTERN int uv_gettimeofday(uv_timeval64_t* tv);
1618+
15891619
typedef void (*uv_thread_cb)(void* arg);
15901620

15911621
UV_EXTERN int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg);

deps/uv/include/uv/unix.h

+3
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ typedef uid_t uv_uid_t;
166166

167167
typedef struct dirent uv__dirent_t;
168168

169+
#define UV_DIR_PRIVATE_FIELDS \
170+
DIR* dir;
171+
169172
#if defined(DT_UNKNOWN)
170173
# define HAVE_DIRENT_TYPES
171174
# if defined(DT_REG)

deps/uv/include/uv/version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232

3333
#define UV_VERSION_MAJOR 1
34-
#define UV_VERSION_MINOR 27
34+
#define UV_VERSION_MINOR 28
3535
#define UV_VERSION_PATCH 0
3636
#define UV_VERSION_IS_RELEASE 1
3737
#define UV_VERSION_SUFFIX ""

0 commit comments

Comments
 (0)