deps: upgrade libuv to joyent/libuv@4bdb7d8
Non-release upgrade so pending patches can land.
This commit is contained in:
parent
4cc57b4aca
commit
3ff2cbc892
1
deps/uv/.gitignore
vendored
1
deps/uv/.gitignore
vendored
@ -14,6 +14,7 @@ vgcore.*
|
||||
/aclocal.m4
|
||||
/ar-lib
|
||||
/autom4te.cache/
|
||||
/compile
|
||||
/config.guess
|
||||
/config.log
|
||||
/config.status
|
||||
|
26
deps/uv/ChangeLog
vendored
26
deps/uv/ChangeLog
vendored
@ -1,4 +1,11 @@
|
||||
2013.07.21, Version 0.11.6 (Unstable)
|
||||
2013.07.26, Version 0.10.13 (Stable), 381312e1fe6fecbabc943ccd56f0e7d114b3d064
|
||||
|
||||
Changes since version 0.10.12:
|
||||
|
||||
* unix, windows: fix uv_fs_chown() function prototype (Ben Noordhuis)
|
||||
|
||||
|
||||
2013.07.21, Version 0.11.6 (Unstable), 6645b93273e0553d23823c576573b82b129bf28c
|
||||
|
||||
Changes since version 0.11.5:
|
||||
|
||||
@ -41,6 +48,23 @@ Changes since version 0.11.5:
|
||||
* unix, windows: return error codes directly (Ben Noordhuis)
|
||||
|
||||
|
||||
2013.07.10, Version 0.10.12 (Stable), 58a46221bba726746887a661a9f36fe9ff204209
|
||||
|
||||
Changes since version 0.10.11:
|
||||
|
||||
* linux: add support for MIPS (Andrei Sedoi)
|
||||
|
||||
* windows: uv_spawn shouldn't reject reparse points (Bert Belder)
|
||||
|
||||
* windows: use WSAGetLastError(), not errno (Ben Noordhuis)
|
||||
|
||||
* build: darwin: disable -fstrict-aliasing warnings (Ben Noordhuis)
|
||||
|
||||
* build: `all` now builds static and dynamic lib (Ben Noordhuis)
|
||||
|
||||
* unix: fix build when !defined(PTHREAD_MUTEX_ERRORCHECK) (Ben Noordhuis)
|
||||
|
||||
|
||||
2013.06.27, Version 0.11.5 (Unstable), e3c63ff1627a14e96f54c1c62b0d68b446d8425b
|
||||
|
||||
Changes since version 0.11.4:
|
||||
|
14
deps/uv/Makefile.am
vendored
14
deps/uv/Makefile.am
vendored
@ -200,24 +200,26 @@ endif
|
||||
if DTRACE_NEEDS_OBJECTS
|
||||
libuv_la_SOURCES += src/unix/uv-dtrace.d
|
||||
libuv_la_DEPENDENCIES = src/unix/uv-dtrace.o
|
||||
libuv_la_LIBADD = src/unix/uv-dtrace.lo
|
||||
libuv_la_LIBADD = uv-dtrace.lo
|
||||
CLEANFILES += src/unix/uv-dtrace.o src/unix/uv-dtrace.lo
|
||||
endif
|
||||
|
||||
SUFFIXES = .d
|
||||
|
||||
include/uv-dtrace.h: src/unix/uv-dtrace.d
|
||||
$(AM_V_GEN)$(DTRACE) $(DTRACEFLAGS) -h -xnolibs -s $< -o $@
|
||||
$(AM_V_GEN)$(DTRACE) $(DTRACEFLAGS) -h -xnolibs -s $< -o $(top_srcdir)/$@
|
||||
|
||||
src/unix/uv-dtrace.o: src/unix/uv-dtrace.d ${libuv_la_OBJECTS}
|
||||
|
||||
# It's ok to specify the output here, because we have 1 .d file, and we process
|
||||
# every created .o, most projects don't need to include more than one .d
|
||||
.d.o:
|
||||
$(AM_V_GEN)$(DTRACE) $(DTRACEFLAGS) -G -o $@ -s $< \
|
||||
`grep '^pic_object' ${top_builddir}/*.lo | cut -f 2 -d\'`
|
||||
$(AM_V_GEN)$(DTRACE) $(DTRACEFLAGS) -G -o $(top_builddir)/uv-dtrace.o -s $< \
|
||||
`grep '^pic_object' $$(find ${top_builddir} -name "*.lo") | cut -f 2 -d\'`
|
||||
$(AM_V_GEN)printf %s\\n \
|
||||
'# $(patsubst %.o, %.lo, $@) - a libtool object file' \
|
||||
'# ${top_builddir}/uv-dtrace.lo - a libtool object file' \
|
||||
'# Generated by libtool (GNU libtool) 2.4' \
|
||||
'# libtool wants a .lo not a .o' \
|
||||
"pic_object='uv-dtrace.o'" \
|
||||
"non_pic_object='uv-dtrace.o'" \
|
||||
> $(patsubst %.o, %.lo, $@)
|
||||
> ${top_builddir}/uv-dtrace.lo
|
||||
|
75
deps/uv/Makefile.mingw
vendored
Normal file
75
deps/uv/Makefile.mingw
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
# Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
CFLAGS = -Wall \
|
||||
-Wextra \
|
||||
-Wno-unused-parameter \
|
||||
-Iinclude \
|
||||
-Isrc \
|
||||
-Isrc/win \
|
||||
-DWIN32_LEAN_AND_MEAN \
|
||||
-D_WIN32_WINNT=0x0600
|
||||
|
||||
INCLUDES = include/stdint-msvc2008.h \
|
||||
include/tree.h \
|
||||
include/uv-errno.h \
|
||||
include/uv-win.h \
|
||||
include/uv.h \
|
||||
src/queue.h \
|
||||
src/uv-common.h \
|
||||
src/win/atomicops-inl.h \
|
||||
src/win/handle-inl.h \
|
||||
src/win/internal.h \
|
||||
src/win/req-inl.h \
|
||||
src/win/stream-inl.h \
|
||||
src/win/winapi.h \
|
||||
src/win/winsock.h
|
||||
|
||||
OBJS = src/fs-poll.o \
|
||||
src/inet.o \
|
||||
src/uv-common.o \
|
||||
src/version.o \
|
||||
src/win/async.o \
|
||||
src/win/core.o \
|
||||
src/win/dl.o \
|
||||
src/win/error.o \
|
||||
src/win/fs-event.o \
|
||||
src/win/fs.o \
|
||||
src/win/getaddrinfo.o \
|
||||
src/win/handle.o \
|
||||
src/win/loop-watcher.o \
|
||||
src/win/pipe.o \
|
||||
src/win/poll.o \
|
||||
src/win/process-stdio.o \
|
||||
src/win/process.o \
|
||||
src/win/req.o \
|
||||
src/win/signal.o \
|
||||
src/win/stream.o \
|
||||
src/win/tcp.o \
|
||||
src/win/thread.o \
|
||||
src/win/threadpool.o \
|
||||
src/win/timer.o \
|
||||
src/win/tty.o \
|
||||
src/win/udp.o \
|
||||
src/win/util.o \
|
||||
src/win/winapi.o \
|
||||
src/win/winsock.o
|
||||
|
||||
all: libuv.a
|
||||
|
||||
libuv.a: $(OBJS)
|
||||
$(AR) crs $@ $^
|
||||
|
||||
# FIXME(bnoordhuis) Don't rebuild everything when a source file changes.
|
||||
$(OBJS): $(OBJS:.o=.c) $(INCLUDES)
|
3
deps/uv/configure.ac
vendored
3
deps/uv/configure.ac
vendored
@ -14,12 +14,13 @@
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT([libuv], [0.11.5], [https://github.com/joyent/libuv/issues])
|
||||
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Werror])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CANONICAL_HOST
|
||||
AC_ENABLE_SHARED
|
||||
AC_ENABLE_STATIC
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
# AM_PROG_AR is not available in automake v0.11 but it's essential in v0.12.
|
||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
4
deps/uv/include/uv-unix.h
vendored
4
deps/uv/include/uv-unix.h
vendored
@ -300,8 +300,8 @@ typedef struct {
|
||||
void* buf; \
|
||||
size_t len; \
|
||||
off_t off; \
|
||||
uid_t uid; \
|
||||
gid_t gid; \
|
||||
uv_uid_t uid; \
|
||||
uv_gid_t gid; \
|
||||
double atime; \
|
||||
double mtime; \
|
||||
struct uv__work work_req; \
|
||||
|
13
deps/uv/include/uv.h
vendored
13
deps/uv/include/uv.h
vendored
@ -342,6 +342,12 @@ UV_EXTERN int uv_backend_timeout(const uv_loop_t*);
|
||||
*
|
||||
* `suggested_size` is a hint. Returning a buffer that is smaller is perfectly
|
||||
* okay as long as `buf.len > 0`.
|
||||
*
|
||||
* If you return a buffer with `buf.len == 0`, libuv skips the read and calls
|
||||
* your read or recv callback with nread=UV_ENOBUFS.
|
||||
*
|
||||
* Note that returning a zero-length buffer does not stop the handle, call
|
||||
* uv_read_stop() or uv_udp_recv_stop() for that.
|
||||
*/
|
||||
typedef uv_buf_t (*uv_alloc_cb)(uv_handle_t* handle, size_t suggested_size);
|
||||
|
||||
@ -1520,6 +1526,7 @@ struct uv_cpu_info_s {
|
||||
|
||||
struct uv_interface_address_s {
|
||||
char* name;
|
||||
char phys_addr[6];
|
||||
int is_internal;
|
||||
union {
|
||||
struct sockaddr_in address4;
|
||||
@ -1625,7 +1632,7 @@ UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
||||
uv_fs_cb cb);
|
||||
|
||||
UV_EXTERN int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
||||
void* buf, size_t length, int64_t offset, uv_fs_cb cb);
|
||||
const void* buf, size_t length, int64_t offset, uv_fs_cb cb);
|
||||
|
||||
UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
||||
int mode, uv_fs_cb cb);
|
||||
@ -1694,10 +1701,10 @@ UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
||||
int mode, uv_fs_cb cb);
|
||||
|
||||
UV_EXTERN int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
||||
int uid, int gid, uv_fs_cb cb);
|
||||
uv_uid_t uid, uv_gid_t gid, uv_fs_cb cb);
|
||||
|
||||
UV_EXTERN int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file file,
|
||||
int uid, int gid, uv_fs_cb cb);
|
||||
uv_uid_t uid, uv_gid_t gid, uv_fs_cb cb);
|
||||
|
||||
|
||||
enum uv_fs_event {
|
||||
|
4
deps/uv/src/unix/aix.c
vendored
4
deps/uv/src/unix/aix.c
vendored
@ -318,7 +318,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name));
|
||||
if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) {
|
||||
close(sockfd);
|
||||
return uv__new_artificial_error(UV_ENOSYS);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
|
||||
@ -349,7 +349,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name));
|
||||
if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) {
|
||||
close(sockfd);
|
||||
return uv__new_artificial_error(UV_ENOSYS);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
|
||||
|
35
deps/uv/src/unix/darwin.c
vendored
35
deps/uv/src/unix/darwin.c
vendored
@ -27,6 +27,7 @@
|
||||
|
||||
#include <ifaddrs.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
|
||||
#include <CoreFoundation/CFRunLoop.h>
|
||||
|
||||
@ -355,6 +356,8 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
|
||||
int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
struct ifaddrs *addrs, *ent;
|
||||
uv_interface_address_t* address;
|
||||
int i;
|
||||
struct sockaddr_dl *sa_addr;
|
||||
|
||||
if (getifaddrs(&addrs))
|
||||
return -errno;
|
||||
@ -363,7 +366,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
|
||||
/* Count the number of interfaces */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!(ent->ifa_flags & IFF_UP && ent->ifa_flags & IFF_RUNNING) ||
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family == AF_LINK)) {
|
||||
continue;
|
||||
@ -379,21 +382,18 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
address = *addresses;
|
||||
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!(ent->ifa_flags & IFF_UP && ent->ifa_flags & IFF_RUNNING)) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ent->ifa_addr == NULL) {
|
||||
if (ent->ifa_addr == NULL)
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* On Mac OS X getifaddrs returns information related to Mac Addresses for
|
||||
* various devices, such as firewire, etc. These are not relevant here.
|
||||
*/
|
||||
if (ent->ifa_addr->sa_family == AF_LINK) {
|
||||
if (ent->ifa_addr->sa_family == AF_LINK)
|
||||
continue;
|
||||
}
|
||||
|
||||
address->name = strdup(ent->ifa_name);
|
||||
|
||||
@ -409,11 +409,30 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
|
||||
}
|
||||
|
||||
address->is_internal = ent->ifa_flags & IFF_LOOPBACK ? 1 : 0;
|
||||
address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK);
|
||||
|
||||
address++;
|
||||
}
|
||||
|
||||
/* Fill in physical addresses for each interface */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family != AF_LINK)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
address = *addresses;
|
||||
|
||||
for (i = 0; i < (*count); i++) {
|
||||
if (strcmp(address->name, ent->ifa_name) == 0) {
|
||||
sa_addr = (struct sockaddr_dl*)(ent->ifa_addr);
|
||||
memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
|
||||
}
|
||||
address++;
|
||||
}
|
||||
}
|
||||
|
||||
freeifaddrs(addrs);
|
||||
|
||||
return 0;
|
||||
|
95
deps/uv/src/unix/freebsd.c
vendored
95
deps/uv/src/unix/freebsd.c
vendored
@ -25,6 +25,10 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <ifaddrs.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
|
||||
#include <kvm.h>
|
||||
#include <paths.h>
|
||||
#include <sys/user.h>
|
||||
@ -322,13 +326,98 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
|
||||
|
||||
|
||||
int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
/* TODO: implement */
|
||||
*addresses = NULL;
|
||||
*count = 0;
|
||||
struct ifaddrs *addrs, *ent;
|
||||
uv_interface_address_t* address;
|
||||
int i;
|
||||
struct sockaddr_dl *sa_addr;
|
||||
|
||||
if (getifaddrs(&addrs))
|
||||
return -errno;
|
||||
|
||||
*count = 0;
|
||||
|
||||
/* Count the number of interfaces */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family == AF_LINK)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
*addresses = malloc(*count * sizeof(**addresses));
|
||||
if (!(*addresses))
|
||||
return -ENOMEM;
|
||||
|
||||
address = *addresses;
|
||||
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
|
||||
continue;
|
||||
|
||||
if (ent->ifa_addr == NULL)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* On FreeBSD getifaddrs returns information related to the raw underlying
|
||||
* devices. We're not interested in this information yet.
|
||||
*/
|
||||
if (ent->ifa_addr->sa_family == AF_LINK)
|
||||
continue;
|
||||
|
||||
address->name = strdup(ent->ifa_name);
|
||||
|
||||
if (ent->ifa_addr->sa_family == AF_INET6) {
|
||||
address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr);
|
||||
} else {
|
||||
address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
|
||||
}
|
||||
|
||||
if (ent->ifa_netmask->sa_family == AF_INET6) {
|
||||
address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
|
||||
} else {
|
||||
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
|
||||
}
|
||||
|
||||
address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK);
|
||||
|
||||
address++;
|
||||
}
|
||||
|
||||
/* Fill in physical addresses for each interface */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family != AF_LINK)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
address = *addresses;
|
||||
|
||||
for (i = 0; i < (*count); i++) {
|
||||
if (strcmp(address->name, ent->ifa_name) == 0) {
|
||||
sa_addr = (struct sockaddr_dl*)(ent->ifa_addr);
|
||||
memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
|
||||
}
|
||||
address++;
|
||||
}
|
||||
}
|
||||
|
||||
freeifaddrs(addrs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void uv_free_interface_addresses(uv_interface_address_t* addresses,
|
||||
int count) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
free(addresses[i].name);
|
||||
}
|
||||
|
||||
free(addresses);
|
||||
}
|
||||
|
12
deps/uv/src/unix/fs.c
vendored
12
deps/uv/src/unix/fs.c
vendored
@ -684,8 +684,8 @@ int uv_fs_chmod(uv_loop_t* loop,
|
||||
int uv_fs_chown(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
const char* path,
|
||||
int uid,
|
||||
int gid,
|
||||
uv_uid_t uid,
|
||||
uv_gid_t gid,
|
||||
uv_fs_cb cb) {
|
||||
INIT(CHOWN);
|
||||
PATH;
|
||||
@ -717,8 +717,8 @@ int uv_fs_fchmod(uv_loop_t* loop,
|
||||
int uv_fs_fchown(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
uv_file file,
|
||||
int uid,
|
||||
int gid,
|
||||
uv_uid_t uid,
|
||||
uv_gid_t gid,
|
||||
uv_fs_cb cb) {
|
||||
INIT(FCHOWN);
|
||||
req->file = file;
|
||||
@ -934,13 +934,13 @@ int uv_fs_utime(uv_loop_t* loop,
|
||||
int uv_fs_write(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
uv_file file,
|
||||
void* buf,
|
||||
const void* buf,
|
||||
size_t len,
|
||||
int64_t off,
|
||||
uv_fs_cb cb) {
|
||||
INIT(WRITE);
|
||||
req->file = file;
|
||||
req->buf = buf;
|
||||
req->buf = (void*) buf;
|
||||
req->len = len;
|
||||
req->off = off;
|
||||
POST;
|
||||
|
41
deps/uv/src/unix/linux-core.c
vendored
41
deps/uv/src/unix/linux-core.c
vendored
@ -47,6 +47,9 @@
|
||||
#endif
|
||||
#ifdef HAVE_IFADDRS_H
|
||||
# include <ifaddrs.h>
|
||||
# include <sys/socket.h>
|
||||
# include <net/ethernet.h>
|
||||
# include <linux/if_packet.h>
|
||||
#endif
|
||||
|
||||
#undef NANOSEC
|
||||
@ -624,8 +627,9 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
return -ENOSYS;
|
||||
#else
|
||||
struct ifaddrs *addrs, *ent;
|
||||
char ip[INET6_ADDRSTRLEN];
|
||||
uv_interface_address_t* address;
|
||||
int i;
|
||||
struct sockaddr_ll *sll;
|
||||
|
||||
if (getifaddrs(&addrs))
|
||||
return -errno;
|
||||
@ -634,7 +638,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
|
||||
/* Count the number of interfaces */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!(ent->ifa_flags & IFF_UP && ent->ifa_flags & IFF_RUNNING) ||
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family == PF_PACKET)) {
|
||||
continue;
|
||||
@ -650,22 +654,18 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
address = *addresses;
|
||||
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
bzero(&ip, sizeof (ip));
|
||||
if (!(ent->ifa_flags & IFF_UP && ent->ifa_flags & IFF_RUNNING)) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ent->ifa_addr == NULL) {
|
||||
if (ent->ifa_addr == NULL)
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* On Linux getifaddrs returns information related to the raw underlying
|
||||
* devices. We're not interested in this information.
|
||||
* devices. We're not interested in this information yet.
|
||||
*/
|
||||
if (ent->ifa_addr->sa_family == PF_PACKET) {
|
||||
if (ent->ifa_addr->sa_family == PF_PACKET)
|
||||
continue;
|
||||
}
|
||||
|
||||
address->name = strdup(ent->ifa_name);
|
||||
|
||||
@ -681,11 +681,30 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
|
||||
}
|
||||
|
||||
address->is_internal = ent->ifa_flags & IFF_LOOPBACK ? 1 : 0;
|
||||
address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK);
|
||||
|
||||
address++;
|
||||
}
|
||||
|
||||
/* Fill in physical addresses for each interface */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family != PF_PACKET)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
address = *addresses;
|
||||
|
||||
for (i = 0; i < (*count); i++) {
|
||||
if (strcmp(address->name, ent->ifa_name) == 0) {
|
||||
sll = (struct sockaddr_ll*)ent->ifa_addr;
|
||||
memcpy(address->phys_addr, sll->sll_addr, sizeof(address->phys_addr));
|
||||
}
|
||||
address++;
|
||||
}
|
||||
}
|
||||
|
||||
freeifaddrs(addrs);
|
||||
|
||||
return 0;
|
||||
|
38
deps/uv/src/unix/netbsd.c
vendored
38
deps/uv/src/unix/netbsd.c
vendored
@ -34,6 +34,7 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
@ -274,9 +275,10 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
|
||||
|
||||
|
||||
int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
struct ifaddrs *addrs;
|
||||
struct ifaddrs *ent;
|
||||
struct ifaddrs *addrs, *ent;
|
||||
uv_interface_address_t* address;
|
||||
int i;
|
||||
struct sockaddr_dl *sa_addr;
|
||||
|
||||
if (getifaddrs(&addrs))
|
||||
return -errno;
|
||||
@ -285,7 +287,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
|
||||
/* Count the number of interfaces */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!(ent->ifa_flags & IFF_UP && ent->ifa_flags & IFF_RUNNING) ||
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family != PF_INET)) {
|
||||
continue;
|
||||
@ -301,17 +303,14 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
address = *addresses;
|
||||
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!(ent->ifa_flags & IFF_UP && ent->ifa_flags & IFF_RUNNING)) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ent->ifa_addr == NULL) {
|
||||
if (ent->ifa_addr == NULL)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ent->ifa_addr->sa_family != PF_INET) {
|
||||
if (ent->ifa_addr->sa_family != PF_INET)
|
||||
continue;
|
||||
}
|
||||
|
||||
address->name = strdup(ent->ifa_name);
|
||||
|
||||
@ -327,11 +326,30 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
|
||||
}
|
||||
|
||||
address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK) ? 1 : 0;
|
||||
address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK);
|
||||
|
||||
address++;
|
||||
}
|
||||
|
||||
/* Fill in physical addresses for each interface */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family != AF_LINK)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
address = *addresses;
|
||||
|
||||
for (i = 0; i < (*count); i++) {
|
||||
if (strcmp(address->name, ent->ifa_name) == 0) {
|
||||
sa_addr = (struct sockaddr_dl*)(ent->ifa_addr);
|
||||
memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
|
||||
}
|
||||
address++;
|
||||
}
|
||||
}
|
||||
|
||||
freeifaddrs(addrs);
|
||||
|
||||
return 0;
|
||||
|
91
deps/uv/src/unix/openbsd.c
vendored
91
deps/uv/src/unix/openbsd.c
vendored
@ -28,6 +28,10 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <ifaddrs.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <kvm.h>
|
||||
@ -291,13 +295,94 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
|
||||
|
||||
int uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
int* count) {
|
||||
/* TODO: implement */
|
||||
*addresses = NULL;
|
||||
*count = 0;
|
||||
struct ifaddrs *addrs, *ent;
|
||||
uv_interface_address_t* address;
|
||||
int i;
|
||||
struct sockaddr_dl *sa_addr;
|
||||
|
||||
if (getifaddrs(&addrs) != 0)
|
||||
return -errno;
|
||||
|
||||
*count = 0;
|
||||
|
||||
/* Count the number of interfaces */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family != PF_INET)) {
|
||||
continue;
|
||||
}
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
*addresses = malloc(*count * sizeof(**addresses));
|
||||
|
||||
if (!(*addresses))
|
||||
return -ENOMEM;
|
||||
|
||||
address = *addresses;
|
||||
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
|
||||
continue;
|
||||
|
||||
if (ent->ifa_addr == NULL)
|
||||
continue;
|
||||
|
||||
if (ent->ifa_addr->sa_family != PF_INET)
|
||||
continue;
|
||||
|
||||
address->name = strdup(ent->ifa_name);
|
||||
|
||||
if (ent->ifa_addr->sa_family == AF_INET6) {
|
||||
address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr);
|
||||
} else {
|
||||
address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
|
||||
}
|
||||
|
||||
if (ent->ifa_netmask->sa_family == AF_INET6) {
|
||||
address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
|
||||
} else {
|
||||
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
|
||||
}
|
||||
|
||||
address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK);
|
||||
|
||||
address++;
|
||||
}
|
||||
|
||||
/* Fill in physical addresses for each interface */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family != AF_LINK)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
address = *addresses;
|
||||
|
||||
for (i = 0; i < (*count); i++) {
|
||||
if (strcmp(address->name, ent->ifa_name) == 0) {
|
||||
sa_addr = (struct sockaddr_dl*)(ent->ifa_addr);
|
||||
memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
|
||||
}
|
||||
address++;
|
||||
}
|
||||
}
|
||||
|
||||
freeifaddrs(addrs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void uv_free_interface_addresses(uv_interface_address_t* addresses,
|
||||
int count) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
free(addresses[i].name);
|
||||
}
|
||||
|
||||
free(addresses);
|
||||
}
|
||||
|
13
deps/uv/src/unix/stream.c
vendored
13
deps/uv/src/unix/stream.c
vendored
@ -977,11 +977,16 @@ static void uv__read(uv_stream_t* stream) {
|
||||
while ((stream->read_cb || stream->read2_cb)
|
||||
&& (stream->flags & UV_STREAM_READING)
|
||||
&& (count-- > 0)) {
|
||||
assert(stream->alloc_cb);
|
||||
buf = stream->alloc_cb((uv_handle_t*)stream, 64 * 1024);
|
||||
assert(stream->alloc_cb != NULL);
|
||||
|
||||
assert(buf.len > 0);
|
||||
assert(buf.base);
|
||||
buf = stream->alloc_cb((uv_handle_t*)stream, 64 * 1024);
|
||||
if (buf.len == 0) {
|
||||
/* User indicates it can't or won't handle the read. */
|
||||
uv__stream_read_cb(stream, UV_ENOBUFS, buf, UV_UNKNOWN_HANDLE);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(buf.base != NULL);
|
||||
assert(uv__stream_fd(stream) >= 0);
|
||||
|
||||
if (stream->read_cb) {
|
||||
|
40
deps/uv/src/unix/sunos.c
vendored
40
deps/uv/src/unix/sunos.c
vendored
@ -32,6 +32,7 @@
|
||||
# include <ifaddrs.h>
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
|
||||
#include <sys/loadavg.h>
|
||||
#include <sys/time.h>
|
||||
@ -579,9 +580,11 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
#ifdef SUNOS_NO_IFADDRS
|
||||
return -ENOSYS;
|
||||
#else
|
||||
struct ifaddrs *addrs, *ent;
|
||||
char ip[INET6_ADDRSTRLEN];
|
||||
uv_interface_address_t* address;
|
||||
struct sockaddr_dl* sa_addr;
|
||||
struct ifaddrs* addrs;
|
||||
struct ifaddrs* ent;
|
||||
int i;
|
||||
|
||||
if (getifaddrs(&addrs))
|
||||
return -errno;
|
||||
@ -590,7 +593,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
|
||||
/* Count the number of interfaces */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!(ent->ifa_flags & IFF_UP && ent->ifa_flags & IFF_RUNNING) ||
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family == PF_PACKET)) {
|
||||
continue;
|
||||
@ -606,15 +609,11 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
address = *addresses;
|
||||
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
memset(&ip, 0, sizeof(ip));
|
||||
|
||||
if (!(ent->ifa_flags & IFF_UP && ent->ifa_flags & IFF_RUNNING)) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ent->ifa_addr == NULL) {
|
||||
if (ent->ifa_addr == NULL)
|
||||
continue;
|
||||
}
|
||||
|
||||
address->name = strdup(ent->ifa_name);
|
||||
|
||||
@ -630,12 +629,31 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
|
||||
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
|
||||
}
|
||||
|
||||
address->is_internal = ent->ifa_flags & IFF_PRIVATE || ent->ifa_flags &
|
||||
IFF_LOOPBACK ? 1 : 0;
|
||||
address->is_internal = !!((ent->ifa_flags & IFF_PRIVATE) ||
|
||||
(ent->ifa_flags & IFF_LOOPBACK));
|
||||
|
||||
address++;
|
||||
}
|
||||
|
||||
/* Fill in physical addresses for each interface */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
if (!((ent->ifa_flags & IFF_UP) && (ent->ifa_flags & IFF_RUNNING)) ||
|
||||
(ent->ifa_addr == NULL) ||
|
||||
(ent->ifa_addr->sa_family != AF_LINK)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
address = *addresses;
|
||||
|
||||
for (i = 0; i < (*count); i++) {
|
||||
if (strcmp(address->name, ent->ifa_name) == 0) {
|
||||
sa_addr = (struct sockaddr_dl*)(ent->ifa_addr);
|
||||
memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr));
|
||||
}
|
||||
address++;
|
||||
}
|
||||
}
|
||||
|
||||
freeifaddrs(addrs);
|
||||
|
||||
return 0;
|
||||
|
7
deps/uv/src/unix/udp.c
vendored
7
deps/uv/src/unix/udp.c
vendored
@ -205,8 +205,11 @@ static void uv__udp_recvmsg(uv_loop_t* loop,
|
||||
h.msg_name = &peer;
|
||||
|
||||
do {
|
||||
buf = handle->alloc_cb((uv_handle_t*)handle, 64 * 1024);
|
||||
assert(buf.len > 0);
|
||||
buf = handle->alloc_cb((uv_handle_t*) handle, 64 * 1024);
|
||||
if (buf.len == 0) {
|
||||
handle->recv_cb(handle, UV_ENOBUFS, buf, NULL, 0);
|
||||
return;
|
||||
}
|
||||
assert(buf.base != NULL);
|
||||
|
||||
h.msg_namelen = sizeof(peer);
|
||||
|
4
deps/uv/src/version.c
vendored
4
deps/uv/src/version.c
vendored
@ -31,8 +31,8 @@
|
||||
|
||||
#define UV_VERSION_MAJOR 0
|
||||
#define UV_VERSION_MINOR 11
|
||||
#define UV_VERSION_PATCH 6
|
||||
#define UV_VERSION_IS_RELEASE 1
|
||||
#define UV_VERSION_PATCH 7
|
||||
#define UV_VERSION_IS_RELEASE 0
|
||||
|
||||
|
||||
#define UV_VERSION ((UV_VERSION_MAJOR << 16) | \
|
||||
|
13
deps/uv/src/win/fs.c
vendored
13
deps/uv/src/win/fs.c
vendored
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <direct.h>
|
||||
#include <errno.h>
|
||||
@ -1520,12 +1521,12 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file fd, void* buf,
|
||||
}
|
||||
|
||||
|
||||
int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file fd, void* buf,
|
||||
int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file fd, const void* buf,
|
||||
size_t length, int64_t offset, uv_fs_cb cb) {
|
||||
uv_fs_req_init(loop, req, UV_FS_WRITE, cb);
|
||||
|
||||
req->fd = fd;
|
||||
req->buf = buf;
|
||||
req->buf = (void*) buf;
|
||||
req->length = length;
|
||||
req->offset = offset;
|
||||
|
||||
@ -1691,8 +1692,8 @@ int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
||||
}
|
||||
|
||||
|
||||
int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, int uid,
|
||||
int gid, uv_fs_cb cb) {
|
||||
int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid,
|
||||
uv_gid_t gid, uv_fs_cb cb) {
|
||||
int err;
|
||||
|
||||
uv_fs_req_init(loop, req, UV_FS_CHOWN, cb);
|
||||
@ -1712,8 +1713,8 @@ int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, int uid,
|
||||
}
|
||||
|
||||
|
||||
int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file fd, int uid,
|
||||
int gid, uv_fs_cb cb) {
|
||||
int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_uid_t uid,
|
||||
uv_gid_t gid, uv_fs_cb cb) {
|
||||
uv_fs_req_init(loop, req, UV_FS_FCHOWN, cb);
|
||||
|
||||
if (cb) {
|
||||
|
11
deps/uv/src/win/pipe.c
vendored
11
deps/uv/src/win/pipe.c
vendored
@ -23,6 +23,7 @@
|
||||
#include <io.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "uv.h"
|
||||
#include "internal.h"
|
||||
@ -1429,7 +1430,15 @@ void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle,
|
||||
}
|
||||
|
||||
buf = handle->alloc_cb((uv_handle_t*) handle, avail);
|
||||
assert(buf.len > 0);
|
||||
if (buf.len == 0) {
|
||||
if (handle->read2_cb) {
|
||||
handle->read2_cb(handle, UV_ENOBUFS, buf, UV_UNKNOWN_HANDLE);
|
||||
} else if (handle->read_cb) {
|
||||
handle->read_cb((uv_stream_t*) handle, UV_ENOBUFS, buf);
|
||||
}
|
||||
break;
|
||||
}
|
||||
assert(buf.base != NULL);
|
||||
|
||||
if (ReadFile(handle->handle,
|
||||
buf.base,
|
||||
|
16
deps/uv/src/win/tcp.c
vendored
16
deps/uv/src/win/tcp.c
vendored
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "uv.h"
|
||||
#include "internal.h"
|
||||
@ -434,7 +435,11 @@ static void uv_tcp_queue_read(uv_loop_t* loop, uv_tcp_t* handle) {
|
||||
if (loop->active_tcp_streams < uv_active_tcp_streams_threshold) {
|
||||
handle->flags &= ~UV_HANDLE_ZERO_READ;
|
||||
handle->read_buffer = handle->alloc_cb((uv_handle_t*) handle, 65536);
|
||||
assert(handle->read_buffer.len > 0);
|
||||
if (handle->read_buffer.len == 0) {
|
||||
handle->read_cb((uv_stream_t*) handle, UV_ENOBUFS, buf);
|
||||
return;
|
||||
}
|
||||
assert(handle->read_buffer.base != NULL);
|
||||
buf = handle->read_buffer;
|
||||
} else {
|
||||
handle->flags |= UV_HANDLE_ZERO_READ;
|
||||
@ -782,7 +787,6 @@ int uv__tcp_connect6(uv_connect_t* req,
|
||||
|
||||
int uv_tcp_getsockname(uv_tcp_t* handle, struct sockaddr* name,
|
||||
int* namelen) {
|
||||
uv_loop_t* loop = handle->loop;
|
||||
int result;
|
||||
|
||||
if (!(handle->flags & UV_HANDLE_BOUND)) {
|
||||
@ -804,7 +808,6 @@ int uv_tcp_getsockname(uv_tcp_t* handle, struct sockaddr* name,
|
||||
|
||||
int uv_tcp_getpeername(uv_tcp_t* handle, struct sockaddr* name,
|
||||
int* namelen) {
|
||||
uv_loop_t* loop = handle->loop;
|
||||
int result;
|
||||
|
||||
if (!(handle->flags & UV_HANDLE_BOUND)) {
|
||||
@ -945,7 +948,12 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
|
||||
/* Do nonblocking reads until the buffer is empty */
|
||||
while (handle->flags & UV_HANDLE_READING) {
|
||||
buf = handle->alloc_cb((uv_handle_t*) handle, 65536);
|
||||
assert(buf.len > 0);
|
||||
if (buf.len == 0) {
|
||||
handle->read_cb(handle, UV_ENOBUFS, buf);
|
||||
break;
|
||||
}
|
||||
assert(buf.base != NULL);
|
||||
|
||||
flags = 0;
|
||||
if (WSARecv(handle->socket,
|
||||
(WSABUF*)&buf,
|
||||
|
10
deps/uv/src/win/tty.c
vendored
10
deps/uv/src/win/tty.c
vendored
@ -348,8 +348,11 @@ static void uv_tty_queue_read_line(uv_loop_t* loop, uv_tty_t* handle) {
|
||||
memset(&req->overlapped, 0, sizeof(req->overlapped));
|
||||
|
||||
handle->read_line_buffer = handle->alloc_cb((uv_handle_t*) handle, 8192);
|
||||
if (handle->read_line_buffer.len == 0) {
|
||||
handle->read_cb(handle, UV_ENOBUFS, handle->read_line_buffer);
|
||||
return;
|
||||
}
|
||||
assert(handle->read_line_buffer.base != NULL);
|
||||
assert(handle->read_line_buffer.len > 0);
|
||||
|
||||
/* Duplicate the console handle, so if we want to cancel the read, we can */
|
||||
/* just close this handle duplicate. */
|
||||
@ -682,6 +685,11 @@ void uv_process_tty_read_raw_req(uv_loop_t* loop, uv_tty_t* handle,
|
||||
/* Allocate a buffer if needed */
|
||||
if (buf_used == 0) {
|
||||
buf = handle->alloc_cb((uv_handle_t*) handle, 1024);
|
||||
if (buf.len == 0) {
|
||||
handle->read_cb((uv_stream_t*) handle, UV_ENOBUFS, buf);
|
||||
goto out;
|
||||
}
|
||||
assert(buf.base != NULL);
|
||||
}
|
||||
|
||||
buf.base[buf_used++] = handle->last_key[handle->last_key_offset++];
|
||||
|
13
deps/uv/src/win/udp.c
vendored
13
deps/uv/src/win/udp.c
vendored
@ -38,7 +38,6 @@ static char uv_zero_[] = "";
|
||||
|
||||
int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name,
|
||||
int* namelen) {
|
||||
uv_loop_t* loop = handle->loop;
|
||||
int result;
|
||||
|
||||
if (!(handle->flags & UV_HANDLE_BOUND)) {
|
||||
@ -273,7 +272,11 @@ static void uv_udp_queue_recv(uv_loop_t* loop, uv_udp_t* handle) {
|
||||
handle->flags &= ~UV_HANDLE_ZERO_READ;
|
||||
|
||||
handle->recv_buffer = handle->alloc_cb((uv_handle_t*) handle, 65536);
|
||||
assert(handle->recv_buffer.len > 0);
|
||||
if (handle->recv_buffer.len == 0) {
|
||||
handle->recv_cb(handle, UV_ENOBUFS, handle->recv_buffer, NULL, 0);
|
||||
return;
|
||||
}
|
||||
assert(handle->recv_buffer.base != NULL);
|
||||
|
||||
buf = handle->recv_buffer;
|
||||
memset(&handle->recv_from, 0, sizeof handle->recv_from);
|
||||
@ -516,7 +519,11 @@ void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle,
|
||||
/* Do a nonblocking receive */
|
||||
/* TODO: try to read multiple datagrams at once. FIONREAD maybe? */
|
||||
buf = handle->alloc_cb((uv_handle_t*) handle, 65536);
|
||||
assert(buf.len > 0);
|
||||
if (buf.len == 0) {
|
||||
handle->recv_cb(handle, UV_ENOBUFS, buf, NULL, 0);
|
||||
goto done;
|
||||
}
|
||||
assert(buf.base != NULL);
|
||||
|
||||
memset(&from, 0, sizeof from);
|
||||
from_len = sizeof from;
|
||||
|
8
deps/uv/src/win/util.c
vendored
8
deps/uv/src/win/util.c
vendored
@ -32,6 +32,7 @@
|
||||
#include "internal.h"
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <winperf.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <psapi.h>
|
||||
#include <tlhelp32.h>
|
||||
@ -939,6 +940,13 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
|
||||
memset(uv_address, 0, sizeof *uv_address);
|
||||
|
||||
uv_address->name = name_buf;
|
||||
|
||||
if (win_address->PhysicalAddressLength == sizeof(uv_address->phys_addr)) {
|
||||
memcpy(uv_address->phys_addr,
|
||||
win_address->PhysicalAddress,
|
||||
sizeof(uv_address->phys_addr));
|
||||
}
|
||||
|
||||
uv_address->is_internal =
|
||||
(win_address->IfType == IF_TYPE_SOFTWARE_LOOPBACK);
|
||||
|
||||
|
22
deps/uv/test/test-fs.c
vendored
22
deps/uv/test/test-fs.c
vendored
@ -104,7 +104,7 @@ static char buf[32];
|
||||
static char test_buf[] = "test-buffer\n";
|
||||
|
||||
|
||||
static void check_permission(const char* filename, int mode) {
|
||||
static void check_permission(const char* filename, unsigned int mode) {
|
||||
int r;
|
||||
uv_fs_t req;
|
||||
uv_stat_t* s;
|
||||
@ -925,16 +925,16 @@ TEST_IMPL(fs_fstat) {
|
||||
r = fstat(file, &t);
|
||||
ASSERT(r == 0);
|
||||
|
||||
ASSERT(s->st_dev == t.st_dev);
|
||||
ASSERT(s->st_mode == t.st_mode);
|
||||
ASSERT(s->st_nlink == t.st_nlink);
|
||||
ASSERT(s->st_uid == t.st_uid);
|
||||
ASSERT(s->st_gid == t.st_gid);
|
||||
ASSERT(s->st_rdev == t.st_rdev);
|
||||
ASSERT(s->st_ino == t.st_ino);
|
||||
ASSERT(s->st_size == t.st_size);
|
||||
ASSERT(s->st_blksize == t.st_blksize);
|
||||
ASSERT(s->st_blocks == t.st_blocks);
|
||||
ASSERT(s->st_dev == (uint64_t) t.st_dev);
|
||||
ASSERT(s->st_mode == (uint64_t) t.st_mode);
|
||||
ASSERT(s->st_nlink == (uint64_t) t.st_nlink);
|
||||
ASSERT(s->st_uid == (uint64_t) t.st_uid);
|
||||
ASSERT(s->st_gid == (uint64_t) t.st_gid);
|
||||
ASSERT(s->st_rdev == (uint64_t) t.st_rdev);
|
||||
ASSERT(s->st_ino == (uint64_t) t.st_ino);
|
||||
ASSERT(s->st_size == (uint64_t) t.st_size);
|
||||
ASSERT(s->st_blksize == (uint64_t) t.st_blksize);
|
||||
ASSERT(s->st_blocks == (uint64_t) t.st_blocks);
|
||||
#if defined(__APPLE__)
|
||||
ASSERT(s->st_atim.tv_sec == t.st_atimespec.tv_sec);
|
||||
ASSERT(s->st_atim.tv_nsec == t.st_atimespec.tv_nsec);
|
||||
|
8
deps/uv/test/test-platform-output.c
vendored
8
deps/uv/test/test-platform-output.c
vendored
@ -72,6 +72,14 @@ TEST_IMPL(platform_output) {
|
||||
for (i = 0; i < count; i++) {
|
||||
printf(" name: %s\n", interfaces[i].name);
|
||||
printf(" internal: %d\n", interfaces[i].is_internal);
|
||||
printf(" physical address: ");
|
||||
printf("%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
(unsigned char)interfaces[i].phys_addr[0],
|
||||
(unsigned char)interfaces[i].phys_addr[1],
|
||||
(unsigned char)interfaces[i].phys_addr[2],
|
||||
(unsigned char)interfaces[i].phys_addr[3],
|
||||
(unsigned char)interfaces[i].phys_addr[4],
|
||||
(unsigned char)interfaces[i].phys_addr[5]);
|
||||
|
||||
if (interfaces[i].address.address4.sin_family == AF_INET) {
|
||||
uv_ip4_name(&interfaces[i].address.address4, buffer, sizeof(buffer));
|
||||
|
Loading…
x
Reference in New Issue
Block a user