Skip to content

Commit fff6162

Browse files
cjihrigBethGriggs
authored andcommitted
deps: upgrade to libuv 1.34.0
Notable changes: - Fix handling of large files in uv_fs_copyfile(). Fixes: #30085 - Fix Android build errors. - uv_sleep() has been added. - uv_interface_addresses() IPv6 netmask support has been fixed. Fixes: #30504 - uv_fs_mkstemp() has been added. PR-URL: #30783 Backport-PR-URL: #31969 Fixes: #30085 Fixes: #30504 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 6826ef0 commit fff6162

26 files changed

+535
-106
lines changed

deps/uv/AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -411,3 +411,4 @@ Ouyang Yadong <oyydoibh@gmail.com>
411411
ZYSzys <zyszys98@gmail.com>
412412
Carl Lei <xecycle@gmail.com>
413413
Stefan Bender <stefan.bender@ntnu.no>
414+
nia <nia@NetBSD.org>

deps/uv/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
275275
src/unix/linux-syscalls.c
276276
src/unix/procfs-exepath.c
277277
src/unix/pthread-fixes.c
278+
src/unix/random-getrandom.c
279+
src/unix/random-sysctl-linux.c
278280
src/unix/sysinfo-loadavg.c)
279281
endif()
280282

@@ -320,7 +322,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
320322
src/unix/linux-syscalls.c
321323
src/unix/procfs-exepath.c
322324
src/unix/random-getrandom.c
323-
src/unix/random-sysctl.c
325+
src/unix/random-sysctl-linux.c
324326
src/unix/sysinfo-loadavg.c)
325327
endif()
326328

deps/uv/ChangeLog

+37
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
2019.12.05, Version 1.34.0 (Stable), 15ae750151ac9341e5945eb38f8982d59fb99201
2+
3+
Changes since version 1.33.1:
4+
5+
* unix: move random-sysctl to random-sysctl-linux (nia)
6+
7+
* netbsd: use KERN_ARND sysctl to get entropy (nia)
8+
9+
* unix: refactor uv__fs_copyfile() logic (cjihrig)
10+
11+
* build: fix android build, add missing sources (Ben Noordhuis)
12+
13+
* build: fix android build, fix symbol redefinition (Ben Noordhuis)
14+
15+
* build: fix android autotools build (Ben Noordhuis)
16+
17+
* fs: handle non-functional statx system call (Milad Farazmand)
18+
19+
* unix,win: add uv_sleep() (cjihrig)
20+
21+
* doc: add richardlau to maintainers (Richard Lau)
22+
23+
* aix: fix netmask for IPv6 (Richard Lau)
24+
25+
* aix: clean up after errors in uv_interface_addresses() (Richard Lau)
26+
27+
* aix: fix setting of physical addresses (Richard Lau)
28+
29+
* fs: add uv_fs_mkstemp (Saúl Ibarra Corretgé)
30+
31+
* unix: switch uv_sleep() to nanosleep() (Ben Noordhuis)
32+
33+
* unix: retry on EINTR in uv_sleep() (Ben Noordhuis)
34+
35+
* zos: fix nanosleep() emulation (Ben Noordhuis)
36+
37+
138
2019.10.20, Version 1.33.1 (Stable), 07ad32138f4d2285ba2226b5e20462b27b091a59
239

340
Changes since version 1.33.0:

deps/uv/MAINTAINERS.md

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ libuv is currently managed by the following individuals:
1717
- GPG key: 9DFE AA5F 481B BF77 2D90 03CE D592 4925 2F8E C41A (pubkey-iwuzhere)
1818
* **Jameson Nash** ([@vtjnash](https://github.com/vtjnash))
1919
* **John Barboza** ([@jbarz](https://github.com/jbarz))
20+
* **Richard Lau** ([@richardlau](https://github.com/richardlau))
21+
- GPG key: C82F A3AE 1CBE DC6B E46B 9360 C43C EC45 C17A B93C (pubkey-richardlau)
2022
* **Santiago Gimeno** ([@santigimeno](https://github.com/santigimeno))
2123
- GPG key: 612F 0EAD 9401 6223 79DF 4402 F28C 3C8D A33C 03BE (pubkey-santigimeno)
2224
* **Saúl Ibarra Corretgé** ([@saghul](https://github.com/saghul))

deps/uv/Makefile.am

+9-2
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,14 @@ endif
387387
if ANDROID
388388
uvinclude_HEADERS += include/uv/android-ifaddrs.h
389389
libuv_la_SOURCES += src/unix/android-ifaddrs.c \
390-
src/unix/pthread-fixes.c
390+
src/unix/linux-core.c \
391+
src/unix/linux-inotify.c \
392+
src/unix/linux-syscalls.c \
393+
src/unix/procfs-exepath.c \
394+
src/unix/pthread-fixes.c \
395+
src/unix/random-getrandom.c \
396+
src/unix/random-sysctl-linux.c \
397+
src/unix/sysinfo-loadavg.c
391398
endif
392399

393400
if CYGWIN
@@ -467,7 +474,7 @@ libuv_la_SOURCES += src/unix/linux-core.c \
467474
src/unix/procfs-exepath.c \
468475
src/unix/proctitle.c \
469476
src/unix/random-getrandom.c \
470-
src/unix/random-sysctl.c \
477+
src/unix/random-sysctl-linux.c \
471478
src/unix/sysinfo-loadavg.c
472479
test_run_tests_LDFLAGS += -lutil
473480
endif

deps/uv/configure.ac

+1-1
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.33.1], [https://github.com/libuv/libuv/issues])
16+
AC_INIT([libuv], [1.34.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])

deps/uv/docs/src/fs.rst

+9-4
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ Data types
9999
UV_FS_LCHOWN,
100100
UV_FS_OPENDIR,
101101
UV_FS_READDIR,
102-
UV_FS_CLOSEDIR
102+
UV_FS_CLOSEDIR,
103+
UV_FS_MKSTEMP
103104
} uv_fs_type;
104105

105106
.. c:type:: uv_statfs_t
@@ -245,10 +246,14 @@ API
245246
246247
.. c:function:: int uv_fs_mkdtemp(uv_loop_t* loop, uv_fs_t* req, const char* tpl, uv_fs_cb cb)
247248
248-
Equivalent to :man:`mkdtemp(3)`.
249+
Equivalent to :man:`mkdtemp(3)`. The result can be found as a null terminated string at `req->path`.
249250
250-
.. note::
251-
The result can be found as a null terminated string at `req->path`.
251+
.. c:function:: int uv_fs_mkstemp(uv_loop_t* loop, uv_fs_t* req, const char* tpl, uv_fs_cb cb)
252+
253+
Equivalent to :man:`mkstemp(3)`. The created file path can be found as a null terminated string at `req->path`.
254+
The file descriptor can be found as an integer at `req->result`.
255+
256+
.. versionadded:: 1.34.0
252257
253258
.. c:function:: int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
254259

deps/uv/docs/src/misc.rst

+7
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ API
679679
:man:`sysctl(2)`.
680680
- FreeBSD: `getrandom(2) <https://www.freebsd.org/cgi/man.cgi?query=getrandom&sektion=2>_`,
681681
or `/dev/urandom` after reading from `/dev/random` once.
682+
- NetBSD: `KERN_ARND` `sysctl(3) <https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+3+NetBSD-current>_`
682683
- macOS, OpenBSD: `getentropy(2) <https://man.openbsd.org/getentropy.2>_`
683684
if available, or `/dev/urandom` after reading from `/dev/random` once.
684685
- AIX: `/dev/random`.
@@ -693,3 +694,9 @@ API
693694
are not used and can be set to `NULL`.
694695
695696
.. versionadded:: 1.33.0
697+
698+
.. c:function:: void uv_sleep(unsigned int msec)
699+
700+
Causes the calling thread to sleep for `msec` milliseconds.
701+
702+
.. versionadded:: 1.34.0

deps/uv/include/uv.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,8 @@ typedef enum {
12581258
UV_FS_OPENDIR,
12591259
UV_FS_READDIR,
12601260
UV_FS_CLOSEDIR,
1261-
UV_FS_STATFS
1261+
UV_FS_STATFS,
1262+
UV_FS_MKSTEMP
12621263
} uv_fs_type;
12631264

12641265
struct uv_dir_s {
@@ -1349,6 +1350,10 @@ UV_EXTERN int uv_fs_mkdtemp(uv_loop_t* loop,
13491350
uv_fs_t* req,
13501351
const char* tpl,
13511352
uv_fs_cb cb);
1353+
UV_EXTERN int uv_fs_mkstemp(uv_loop_t* loop,
1354+
uv_fs_t* req,
1355+
const char* tpl,
1356+
uv_fs_cb cb);
13521357
UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop,
13531358
uv_fs_t* req,
13541359
const char* path,
@@ -1641,6 +1646,7 @@ UV_EXTERN uint64_t uv_get_total_memory(void);
16411646
UV_EXTERN uint64_t uv_get_constrained_memory(void);
16421647

16431648
UV_EXTERN uint64_t uv_hrtime(void);
1649+
UV_EXTERN void uv_sleep(unsigned int msec);
16441650

16451651
UV_EXTERN void uv_disable_stdio_inheritance(void);
16461652

deps/uv/include/uv/version.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
*/
3232

3333
#define UV_VERSION_MAJOR 1
34-
#define UV_VERSION_MINOR 33
35-
#define UV_VERSION_PATCH 1
34+
#define UV_VERSION_MINOR 34
35+
#define UV_VERSION_PATCH 0
3636
#define UV_VERSION_IS_RELEASE 1
3737
#define UV_VERSION_SUFFIX ""
3838

deps/uv/src/random.c

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ static int uv__random(void* buf, size_t buflen) {
4040
rc = uv__random_getentropy(buf, buflen);
4141
if (rc == UV_ENOSYS)
4242
rc = uv__random_devurandom(buf, buflen);
43+
#elif defined(__NetBSD__)
44+
rc = uv__random_sysctl(buf, buflen);
4345
#elif defined(__FreeBSD__) || defined(__linux__)
4446
rc = uv__random_getrandom(buf, buflen);
4547
if (rc == UV_ENOSYS)

deps/uv/src/unix/aix-common.c

+82-32
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <sys/ioctl.h>
3535
#include <net/if.h>
3636
#include <netinet/in.h>
37+
#include <netinet/in6_var.h>
3738
#include <arpa/inet.h>
3839

3940
#include <sys/time.h>
@@ -158,28 +159,42 @@ int uv_exepath(char* buffer, size_t* size) {
158159

159160
int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
160161
uv_interface_address_t* address;
161-
int sockfd, inet6, size = 1;
162+
int sockfd, sock6fd, inet6, i, r, size = 1;
162163
struct ifconf ifc;
163164
struct ifreq *ifr, *p, flg;
165+
struct in6_ifreq if6;
164166
struct sockaddr_dl* sa_addr;
165167

168+
ifc.ifc_req = NULL;
169+
sock6fd = -1;
170+
r = 0;
166171
*count = 0;
167172
*addresses = NULL;
168173

169174
if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) {
170-
return UV__ERR(errno);
175+
r = UV__ERR(errno);
176+
goto cleanup;
177+
}
178+
179+
if (0 > (sock6fd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_IP))) {
180+
r = UV__ERR(errno);
181+
goto cleanup;
171182
}
172183

173184
if (ioctl(sockfd, SIOCGSIZIFCONF, &size) == -1) {
174-
uv__close(sockfd);
175-
return UV__ERR(errno);
185+
r = UV__ERR(errno);
186+
goto cleanup;
176187
}
177188

178189
ifc.ifc_req = (struct ifreq*)uv__malloc(size);
190+
if (ifc.ifc_req == NULL) {
191+
r = UV_ENOMEM;
192+
goto cleanup;
193+
}
179194
ifc.ifc_len = size;
180195
if (ioctl(sockfd, SIOCGIFCONF, &ifc) == -1) {
181-
uv__close(sockfd);
182-
return UV__ERR(errno);
196+
r = UV__ERR(errno);
197+
goto cleanup;
183198
}
184199

185200
#define ADDR_SIZE(p) MAX((p).sa_len, sizeof(p))
@@ -197,8 +212,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
197212

198213
memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name));
199214
if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) {
200-
uv__close(sockfd);
201-
return UV__ERR(errno);
215+
r = UV__ERR(errno);
216+
goto cleanup;
202217
}
203218

204219
if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
@@ -207,16 +222,14 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
207222
(*count)++;
208223
}
209224

210-
if (*count == 0) {
211-
uv__close(sockfd);
212-
return 0;
213-
}
225+
if (*count == 0)
226+
goto cleanup;
214227

215228
/* Alloc the return interface structs */
216-
*addresses = uv__malloc(*count * sizeof(uv_interface_address_t));
229+
*addresses = uv__calloc(*count, sizeof(**addresses));
217230
if (!(*addresses)) {
218-
uv__close(sockfd);
219-
return UV_ENOMEM;
231+
r = UV_ENOMEM;
232+
goto cleanup;
220233
}
221234
address = *addresses;
222235

@@ -233,10 +246,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
233246
inet6 = (p->ifr_addr.sa_family == AF_INET6);
234247

235248
memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name));
236-
if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) {
237-
uv__close(sockfd);
238-
return UV_ENOSYS;
239-
}
249+
if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1)
250+
goto syserror;
240251

241252
if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
242253
continue;
@@ -250,28 +261,67 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
250261
else
251262
address->address.address4 = *((struct sockaddr_in*) &p->ifr_addr);
252263

253-
sa_addr = (struct sockaddr_dl*) &p->ifr_addr;
254-
memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
255-
256-
if (ioctl(sockfd, SIOCGIFNETMASK, p) == -1) {
257-
uv__close(sockfd);
258-
return UV_ENOSYS;
259-
}
260-
261-
if (inet6)
262-
address->netmask.netmask6 = *((struct sockaddr_in6*) &p->ifr_addr);
263-
else
264+
if (inet6) {
265+
memset(&if6, 0, sizeof(if6));
266+
r = uv__strscpy(if6.ifr_name, p->ifr_name, sizeof(if6.ifr_name));
267+
if (r == UV_E2BIG)
268+
goto cleanup;
269+
r = 0;
270+
memcpy(&if6.ifr_Addr, &p->ifr_addr, sizeof(if6.ifr_Addr));
271+
if (ioctl(sock6fd, SIOCGIFNETMASK6, &if6) == -1)
272+
goto syserror;
273+
address->netmask.netmask6 = *((struct sockaddr_in6*) &if6.ifr_Addr);
274+
/* Explicitly set family as the ioctl call appears to return it as 0. */
275+
address->netmask.netmask6.sin6_family = AF_INET6;
276+
} else {
277+
if (ioctl(sockfd, SIOCGIFNETMASK, p) == -1)
278+
goto syserror;
264279
address->netmask.netmask4 = *((struct sockaddr_in*) &p->ifr_addr);
280+
/* Explicitly set family as the ioctl call appears to return it as 0. */
281+
address->netmask.netmask4.sin_family = AF_INET;
282+
}
265283

266284
address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0;
267285

268286
address++;
269287
}
270288

289+
/* Fill in physical addresses. */
290+
ifr = ifc.ifc_req;
291+
while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) {
292+
p = ifr;
293+
ifr = (struct ifreq*)
294+
((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr));
295+
296+
if (p->ifr_addr.sa_family != AF_LINK)
297+
continue;
298+
299+
address = *addresses;
300+
for (i = 0; i < *count; i++) {
301+
if (strcmp(address->name, p->ifr_name) == 0) {
302+
sa_addr = (struct sockaddr_dl*) &p->ifr_addr;
303+
memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
304+
}
305+
address++;
306+
}
307+
}
308+
271309
#undef ADDR_SIZE
310+
goto cleanup;
272311

273-
uv__close(sockfd);
274-
return 0;
312+
syserror:
313+
uv_free_interface_addresses(*addresses, *count);
314+
*addresses = NULL;
315+
*count = 0;
316+
r = UV_ENOSYS;
317+
318+
cleanup:
319+
if (sockfd != -1)
320+
uv__close(sockfd);
321+
if (sock6fd != -1)
322+
uv__close(sock6fd);
323+
uv__free(ifc.ifc_req);
324+
return r;
275325
}
276326

277327

0 commit comments

Comments
 (0)