Browse Source

uv: upgrade to a28f145

v0.9.2-release
Bert Belder 13 years ago
parent
commit
d908b83f59
  1. 8
      deps/uv/config-unix.mk
  2. 5
      deps/uv/include/uv-private/uv-win.h
  3. 3
      deps/uv/include/uv.h
  4. 2
      deps/uv/src/fs-poll.c
  5. 393
      deps/uv/src/unix/aix.c
  6. 84
      deps/uv/src/unix/eio/config_aix.h
  7. 2
      deps/uv/src/unix/eio/eio.c
  8. 4
      deps/uv/src/unix/eio/xthread.h
  9. 2
      deps/uv/src/unix/error.c
  10. 122
      deps/uv/src/unix/ev/config_aix.h
  11. 4
      deps/uv/src/unix/ev/ev.c
  12. 6
      deps/uv/src/win/async.c
  13. 8
      deps/uv/src/win/fs-event.c
  14. 4
      deps/uv/src/win/handle-inl.h
  15. 6
      deps/uv/src/win/handle.c
  16. 4
      deps/uv/src/win/internal.h
  17. 2
      deps/uv/src/win/loop-watcher.c
  18. 8
      deps/uv/src/win/pipe.c
  19. 10
      deps/uv/src/win/poll.c
  20. 4
      deps/uv/src/win/process.c
  21. 4
      deps/uv/src/win/signal.c
  22. 6
      deps/uv/src/win/tcp.c
  23. 7
      deps/uv/src/win/thread.c
  24. 4
      deps/uv/src/win/threadpool.c
  25. 2
      deps/uv/src/win/timer.c
  26. 14
      deps/uv/src/win/tty.c
  27. 2
      deps/uv/src/win/udp.c
  28. 10
      deps/uv/test/test-fs.c
  29. 6
      deps/uv/test/test-thread.c
  30. 21
      deps/uv/uv.gyp

8
deps/uv/config-unix.mk

@ -53,6 +53,14 @@ LINKFLAGS+=-lsocket -lnsl -lkstat
OBJS += src/unix/sunos.o
endif
ifeq (AIX,$(uname_S))
EV_CONFIG=config_aix.h
EIO_CONFIG=config_aix.h
CPPFLAGS += -Isrc/ares/config_aix -D_ALL_SOURCE -D_XOPEN_SOURCE=500
LINKFLAGS+= -lperfstat
OBJS += src/unix/aix.o
endif
ifeq (Darwin,$(uname_S))
EV_CONFIG=config_darwin.h
EIO_CONFIG=config_darwin.h

5
deps/uv/include/uv-private/uv-win.h

@ -219,14 +219,11 @@ typedef union {
} fallback_;
} uv_rwlock_t;
#define UV_ONCE_INIT { 0, NULL, NULL }
#define UV_ONCE_INIT { 0, NULL }
typedef struct uv_once_s {
unsigned char ran;
/* The actual event handle must be aligned to sizeof(HANDLE), so in */
/* practice it might overlap padding a little. */
HANDLE event;
HANDLE padding;
} uv_once_t;
/* Platform-specific definitions for uv_spawn support. */

3
deps/uv/include/uv.h

@ -57,7 +57,8 @@ extern "C" {
# define __unix__
#endif
#if defined(__unix__) || defined(__POSIX__) || defined(__APPLE__)
#if defined(__unix__) || defined(__POSIX__) || \
defined(__APPLE__) || defined(_AIX)
# include "uv-private/uv-unix.h"
#else
# include "uv-private/uv-win.h"

2
deps/uv/src/fs-poll.c

@ -236,7 +236,7 @@ static int statbuf_eq(const uv_statbuf_t* a, const uv_statbuf_t* b) {
#include "win/handle-inl.h"
void uv__fs_poll_endgame(uv_loop_t* loop, uv_fs_poll_t* handle) {
assert(handle->flags & UV_HANDLE_CLOSING);
assert(handle->flags & UV__HANDLE_CLOSING);
assert(!(handle->flags & UV_HANDLE_CLOSED));
uv__handle_close(handle);
}

393
deps/uv/src/unix/aix.c

@ -0,0 +1,393 @@
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include "uv.h"
#include "internal.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <unistd.h>
#include <fcntl.h>
#include <utmp.h>
#include <sys/protosw.h>
#include <libperfstat.h>
#include <sys/proc.h>
#include <sys/procfs.h>
uint64_t uv_hrtime() {
uint64_t G = 1000000000;
timebasestruct_t t;
read_wall_time(&t, TIMEBASE_SZ);
time_base_to_time(&t, TIMEBASE_SZ);
return (uint64_t) t.tb_high * G + t.tb_low;
}
/*
* We could use a static buffer for the path manipulations that we need outside
* of the function, but this function could be called by multiple consumers and
* we don't want to potentially create a race condition in the use of snprintf.
*/
int uv_exepath(char* buffer, size_t* size) {
ssize_t res;
char pp[64], cwdl[PATH_MAX];
size_t cwdl_len;
struct psinfo ps;
int fd;
if (buffer == NULL)
return (-1);
if (size == NULL)
return (-1);
(void) snprintf(pp, sizeof(pp), "/proc/%lu/cwd", (unsigned long) getpid());
res = readlink(pp, cwdl, sizeof(cwdl) - 1);
if (res < 0)
return res;
cwdl[res] = '\0';
cwdl_len = res;
(void) snprintf(pp, sizeof(pp), "/proc/%lu/psinfo", (unsigned long) getpid());
fd = open(pp, O_RDONLY);
if (fd < 0)
return fd;
res = read(fd, &ps, sizeof(ps));
close(fd);
if (res < 0)
return res;
(void) snprintf(buffer, *size, "%s%s", cwdl, ps.pr_fname);
*size = strlen(buffer);
return 0;
}
uint64_t uv_get_free_memory(void) {
perfstat_memory_total_t mem_total;
int result = perfstat_memory_total(NULL, &mem_total, sizeof(mem_total), 1);
if (result == -1) {
return 0;
}
return mem_total.real_free * 4096;
}
uint64_t uv_get_total_memory(void) {
perfstat_memory_total_t mem_total;
int result = perfstat_memory_total(NULL, &mem_total, sizeof(mem_total), 1);
if (result == -1) {
return 0;
}
return mem_total.real_total * 4096;
}
void uv_loadavg(double avg[3]) {
perfstat_cpu_total_t ps_total;
int result = perfstat_cpu_total(NULL, &ps_total, sizeof(ps_total), 1);
if (result == -1) {
avg[0] = 0.; avg[1] = 0.; avg[2] = 0.;
return;
}
avg[0] = ps_total.loadavg[0] / (double)(1 << SBITS);
avg[1] = ps_total.loadavg[1] / (double)(1 << SBITS);
avg[2] = ps_total.loadavg[2] / (double)(1 << SBITS);
}
int uv_fs_event_init(uv_loop_t* loop,
uv_fs_event_t* handle,
const char* filename,
uv_fs_event_cb cb,
int flags) {
loop->counters.fs_event_init++;
uv__set_sys_error(loop, ENOSYS);
return -1;
}
void uv__fs_event_close(uv_fs_event_t* handle) {
UNREACHABLE();
}
char** uv_setup_args(int argc, char** argv) {
return argv;
}
uv_err_t uv_set_process_title(const char* title) {
return uv_ok_;
}
uv_err_t uv_get_process_title(char* buffer, size_t size) {
if (size > 0) {
buffer[0] = '\0';
}
return uv_ok_;
}
uv_err_t uv_resident_set_memory(size_t* rss) {
char pp[64];
psinfo_t psinfo;
uv_err_t err;
int fd;
(void) snprintf(pp, sizeof(pp), "/proc/%lu/psinfo", (unsigned long) getpid());
fd = open(pp, O_RDONLY);
if (fd == -1)
return uv__new_sys_error(errno);
err = uv_ok_;
if (read(fd, &psinfo, sizeof(psinfo)) == sizeof(psinfo))
*rss = (size_t)psinfo.pr_rssize * 1024;
else
err = uv__new_sys_error(EINVAL);
close(fd);
return err;
}
uv_err_t uv_uptime(double* uptime) {
struct utmp *utmp_buf;
size_t entries = 0;
time_t boot_time;
utmpname(UTMP_FILE);
setutent();
while ((utmp_buf = getutent()) != NULL) {
if (utmp_buf->ut_user[0] && utmp_buf->ut_type == USER_PROCESS)
++entries;
if (utmp_buf->ut_type == BOOT_TIME)
boot_time = utmp_buf->ut_time;
}
endutent();
if (boot_time == 0)
return uv__new_artificial_error(UV_ENOSYS);
*uptime = time(NULL) - boot_time;
return uv_ok_;
}
uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
uv_cpu_info_t* cpu_info;
perfstat_cpu_total_t ps_total;
perfstat_cpu_t* ps_cpus;
perfstat_id_t cpu_id;
int result, ncpus, idx = 0;
result = perfstat_cpu_total(NULL, &ps_total, sizeof(ps_total), 1);
if (result == -1) {
return uv__new_artificial_error(UV_ENOSYS);
}
ncpus = result = perfstat_cpu(NULL, NULL, sizeof(perfstat_cpu_t), 0);
if (result == -1) {
return uv__new_artificial_error(UV_ENOSYS);
}
ps_cpus = (perfstat_cpu_t*) malloc(ncpus * sizeof(perfstat_cpu_t));
if (!ps_cpus) {
return uv__new_artificial_error(UV_ENOMEM);
}
strcpy(cpu_id.name, FIRST_CPU);
result = perfstat_cpu(&cpu_id, ps_cpus, sizeof(perfstat_cpu_t), ncpus);
if (result == -1) {
free(ps_cpus);
return uv__new_artificial_error(UV_ENOSYS);
}
*cpu_infos = (uv_cpu_info_t*) malloc(ncpus * sizeof(uv_cpu_info_t));
if (!*cpu_infos) {
free(ps_cpus);
return uv__new_artificial_error(UV_ENOMEM);
}
*count = ncpus;
cpu_info = *cpu_infos;
while (idx < ncpus) {
cpu_info->speed = (int)(ps_total.processorHZ / 1000000);
cpu_info->model = strdup(ps_total.description);
cpu_info->cpu_times.user = ps_cpus[idx].user;
cpu_info->cpu_times.sys = ps_cpus[idx].sys;
cpu_info->cpu_times.idle = ps_cpus[idx].idle;
cpu_info->cpu_times.irq = ps_cpus[idx].wait;
cpu_info->cpu_times.nice = 0;
cpu_info++;
idx++;
}
free(ps_cpus);
return uv_ok_;
}
void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
int i;
for (i = 0; i < count; ++i) {
free(cpu_infos[i].model);
}
free(cpu_infos);
}
uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
int* count) {
uv_interface_address_t* address;
int sockfd, size = 1;
struct ifconf ifc;
struct ifreq *ifr, *p, flg;
*count = 0;
if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) {
return uv__new_artificial_error(UV_ENOSYS);
}
if (ioctl(sockfd, SIOCGSIZIFCONF, &size) == -1) {
close(sockfd);
return uv__new_artificial_error(UV_ENOSYS);
}
ifc.ifc_req = (struct ifreq*)malloc(size);
ifc.ifc_len = size;
if (ioctl(sockfd, SIOCGIFCONF, &ifc) == -1) {
close(sockfd);
return uv__new_artificial_error(UV_ENOSYS);
}
#define ADDR_SIZE(p) MAX((p).sa_len, sizeof(p))
/* Count all up and running ipv4/ipv6 addresses */
ifr = ifc.ifc_req;
while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) {
p = ifr;
ifr = (struct ifreq*)
((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr));
if (!(p->ifr_addr.sa_family == AF_INET6 ||
p->ifr_addr.sa_family == AF_INET))
continue;
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);
}
if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
continue;
(*count)++;
}
/* Alloc the return interface structs */
*addresses = (uv_interface_address_t*)
malloc(*count * sizeof(uv_interface_address_t));
if (!(*addresses)) {
close(sockfd);
return uv__new_artificial_error(UV_ENOMEM);
}
address = *addresses;
ifr = ifc.ifc_req;
while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) {
p = ifr;
ifr = (struct ifreq*)
((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr));
if (!(p->ifr_addr.sa_family == AF_INET6 ||
p->ifr_addr.sa_family == AF_INET))
continue;
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);
}
if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
continue;
/* All conditions above must match count loop */
address->name = strdup(p->ifr_name);
if (p->ifr_addr.sa_family == AF_INET6) {
address->address.address6 = *((struct sockaddr_in6 *)&p->ifr_addr);
} else {
address->address.address4 = *((struct sockaddr_in *)&p->ifr_addr);
}
address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0;
address++;
}
#undef ADDR_SIZE
close(sockfd);
return uv_ok_;
}
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);
}

84
deps/uv/src/unix/eio/config_aix.h

@ -0,0 +1,84 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* fdatasync(2) is available */
/* #undef HAVE_FDATASYNC */
/* utimes(2) is available */
#define HAVE_UTIMES 1
/* futimes(2) is available */
/* #undef HAVE_FUTIMES */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* pread(2) and pwrite(2) are available */
#define HAVE_PREADWRITE 1
/* readahead(2) is available (linux) */
/* #undef HAVE_READAHEAD */
/* sendfile(2) is available and supported */
/* #undef HAVE_SENDFILE */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* sync_file_range(2) is available */
/* #undef HAVE_SYNC_FILE_RANGE */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "libeio"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "1.0"

2
deps/uv/src/unix/eio/eio.c

@ -595,7 +595,7 @@ etp_start_thread (void)
X_LOCK (wrklock);
if (thread_create (&wrk->tid, etp_proc, (void *)wrk))
if (xthread_create (&wrk->tid, etp_proc, (void *)wrk))
{
wrk->prev = &wrk_first;
wrk->next = wrk_first.next;

4
deps/uv/src/unix/eio/xthread.h

@ -49,7 +49,7 @@ typedef pthread_t xthread_t;
#define X_THREAD_ATFORK(a,b,c)
static int
thread_create (xthread_t *tid, void *(*proc)(void *), void *arg)
xthread_create (xthread_t *tid, void *(*proc)(void *), void *arg)
{
int retval;
pthread_attr_t attr;
@ -130,7 +130,7 @@ typedef pthread_t xthread_t;
#endif
static int
thread_create (xthread_t *tid, void *(*proc)(void *), void *arg)
xthread_create (xthread_t *tid, void *(*proc)(void *), void *arg)
{
int retval;
sigset_t fullsigset, oldsigset;

2
deps/uv/src/unix/error.c

@ -96,7 +96,9 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ETIMEDOUT: return UV_ETIMEDOUT;
case EXDEV: return UV_EXDEV;
case EBUSY: return UV_EBUSY;
#if ENOTEMPTY != EEXIST
case ENOTEMPTY: return UV_ENOTEMPTY;
#endif
case ENOSPC: return UV_ENOSPC;
case EROFS: return UV_EROFS;
case ENOMEM: return UV_ENOMEM;

122
deps/uv/src/unix/ev/config_aix.h

@ -0,0 +1,122 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `clock_gettime' function. */
#define HAVE_CLOCK_GETTIME 1
/* "use syscall interface for clock_gettime" */
/* #undef HAVE_CLOCK_SYSCALL */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `epoll_ctl' function. */
/* #undef HAVE_EPOLL_CTL */
/* Define to 1 if you have the `eventfd' function. */
/* #undef HAVE_EVENTFD */
/* Define to 1 if you have the `inotify_init' function. */
/* #undef HAVE_INOTIFY_INIT */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `kqueue' function. */
/* #undef HAVE_KQUEUE */
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
/* Define to 1 if you have the `rt' library (-lrt). */
#define HAVE_LIBRT 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `nanosleep' function. */
#define HAVE_NANOSLEEP 1
/* Define to 1 if you have the `poll' function. */
#define HAVE_POLL 1
/* Define to 1 if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
/* Define to 1 if you have the `port_create' function. */
/* #undef HAVE_PORT_CREATE */
/* Define to 1 if you have the <port.h> header file. */
#define HAVE_PORT_H 1
/* Define to 1 if you have the `select' function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the `signalfd' function. */
/* #undef HAVE_SIGNALFD */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/epoll.h> header file. */
/* #undef HAVE_SYS_EPOLL_H */
/* Define to 1 if you have the <sys/eventfd.h> header file. */
/* #undef HAVE_SYS_EVENTFD_H */
/* Define to 1 if you have the <sys/event.h> header file. */
/* #undef HAVE_SYS_EVENT_H */
/* Define to 1 if you have the <sys/inotify.h> header file. */
/* #undef HAVE_SYS_INOTIFY_H */
/* Define to 1 if you have the <sys/queue.h> header file. */
#define HAVE_SYS_QUEUE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/signalfd.h> header file. */
/* #undef HAVE_SYS_SIGNALFD_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Name of package */
#define PACKAGE "libev"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "3.9"

4
deps/uv/src/unix/ev/ev.c

@ -3912,8 +3912,8 @@ ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w))
wl = wn;
}
#endif
/* EV_STAT 0x00001000 /* stat data changed */
/* EV_EMBED 0x00010000 /* embedded event loop needs sweep */
/* EV_STAT 0x00001000 *//* stat data changed */
/* EV_EMBED 0x00010000 *//* embedded event loop needs sweep */
}
#endif

6
deps/uv/src/win/async.c

@ -29,7 +29,7 @@
void uv_async_endgame(uv_loop_t* loop, uv_async_t* handle) {
if (handle->flags & UV_HANDLE_CLOSING &&
if (handle->flags & UV__HANDLE_CLOSING &&
!handle->async_sent) {
assert(!(handle->flags & UV_HANDLE_CLOSED));
uv__handle_close(handle);
@ -74,7 +74,7 @@ int uv_async_send(uv_async_t* handle) {
/* The user should make sure never to call uv_async_send to a closing */
/* or closed handle. */
assert(!(handle->flags & UV_HANDLE_CLOSING));
assert(!(handle->flags & UV__HANDLE_CLOSING));
if (!uv__atomic_exchange_set(&handle->async_sent)) {
POST_COMPLETION_FOR_REQ(loop, &handle->async_req);
@ -91,7 +91,7 @@ void uv_process_async_wakeup_req(uv_loop_t* loop, uv_async_t* handle,
handle->async_sent = 0;
if (!(handle->flags & UV_HANDLE_CLOSING)) {
if (!(handle->flags & UV__HANDLE_CLOSING)) {
handle->async_cb((uv_async_t*) handle, 0);
} else {
uv_want_endgame(loop, (uv_handle_t*)handle);

8
deps/uv/src/win/fs-event.c

@ -301,7 +301,7 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
/* If we're closing, don't report any callbacks, and just push the handle */
/* onto the endgame queue. */
if (handle->flags & UV_HANDLE_CLOSING) {
if (handle->flags & UV__HANDLE_CLOSING) {
uv_want_endgame(loop, (uv_handle_t*) handle);
return;
};
@ -443,7 +443,7 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
}
offset = file_info->NextEntryOffset;
} while (offset && !(handle->flags & UV_HANDLE_CLOSING));
} while (offset && !(handle->flags & UV__HANDLE_CLOSING));
} else {
handle->cb(handle, NULL, UV_CHANGE, 0);
}
@ -452,7 +452,7 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
handle->cb(handle, NULL, 0, -1);
}
if (!(handle->flags & UV_HANDLE_CLOSING)) {
if (!(handle->flags & UV__HANDLE_CLOSING)) {
uv_fs_event_queue_readdirchanges(loop, handle);
} else {
uv_want_endgame(loop, (uv_handle_t*)handle);
@ -475,7 +475,7 @@ void uv_fs_event_close(uv_loop_t* loop, uv_fs_event_t* handle) {
void uv_fs_event_endgame(uv_loop_t* loop, uv_fs_event_t* handle) {
if (handle->flags & UV_HANDLE_CLOSING &&
if (handle->flags & UV__HANDLE_CLOSING &&
!handle->req_pending) {
assert(!(handle->flags & UV_HANDLE_CLOSED));

4
deps/uv/src/win/handle-inl.h

@ -31,7 +31,7 @@
#define DECREASE_ACTIVE_COUNT(loop, handle) \
do { \
if (--(handle)->activecnt == 0 && \
!((handle)->flags & UV_HANDLE_CLOSING)) { \
!((handle)->flags & UV__HANDLE_CLOSING)) { \
uv__handle_stop((handle)); \
} \
assert((handle)->activecnt >= 0); \
@ -52,7 +52,7 @@
assert(handle->reqs_pending > 0); \
handle->reqs_pending--; \
\
if (handle->flags & UV_HANDLE_CLOSING && \
if (handle->flags & UV__HANDLE_CLOSING && \
handle->reqs_pending == 0) { \
uv_want_endgame(loop, (uv_handle_t*)handle); \
} \

6
deps/uv/src/win/handle.c

@ -59,14 +59,14 @@ uv_handle_type uv_guess_handle(uv_file file) {
int uv_is_active(const uv_handle_t* handle) {
return (handle->flags & UV__HANDLE_ACTIVE) &&
!(handle->flags & UV_HANDLE_CLOSING);
!(handle->flags & UV__HANDLE_CLOSING);
}
void uv_close(uv_handle_t* handle, uv_close_cb cb) {
uv_loop_t* loop = handle->loop;
if (handle->flags & UV_HANDLE_CLOSING) {
if (handle->flags & UV__HANDLE_CLOSING) {
assert(0);
return;
}
@ -149,5 +149,5 @@ void uv_close(uv_handle_t* handle, uv_close_cb cb) {
int uv_is_closing(const uv_handle_t* handle) {
return handle->flags & (UV_HANDLE_CLOSING | UV_HANDLE_CLOSED);
return handle->flags & (UV__HANDLE_CLOSING | UV_HANDLE_CLOSED);
}

4
deps/uv/src/win/internal.h

@ -36,14 +36,14 @@
*/
/* Used by all handles. */
#define UV_HANDLE_CLOSING 0x00000001
#define UV_HANDLE_CLOSED 0x00000002
#define UV_HANDLE_ENDGAME_QUEUED 0x00000004
#define UV_HANDLE_ACTIVE 0x00000010
/* uv-common.h: #define UV__HANDLE_CLOSING 0x00000001 */
/* uv-common.h: #define UV__HANDLE_ACTIVE 0x00000040 */
/* uv-common.h: #define UV__HANDLE_REF 0x00000020 */
/* reserved: #define UV_HANDLE_INTERNAL 0x00000080 */
/* uv-common.h: #define UV_HANDLE_INTERNAL 0x00000080 */
/* Used by streams and UDP handles. */
#define UV_HANDLE_READING 0x00000100

2
deps/uv/src/win/loop-watcher.c

@ -27,7 +27,7 @@
void uv_loop_watcher_endgame(uv_loop_t* loop, uv_handle_t* handle) {
if (handle->flags & UV_HANDLE_CLOSING) {
if (handle->flags & UV__HANDLE_CLOSING) {
assert(!(handle->flags & UV_HANDLE_CLOSED));
handle->flags |= UV_HANDLE_CLOSED;
uv__handle_close(handle);

8
deps/uv/src/win/pipe.c

@ -292,7 +292,7 @@ void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle) {
/* Clear the shutdown_req field so we don't go here again. */
handle->shutdown_req = NULL;
if (handle->flags & UV_HANDLE_CLOSING) {
if (handle->flags & UV__HANDLE_CLOSING) {
UNREGISTER_HANDLE_REQ(loop, handle, req);
/* Already closing. Cancel the shutdown. */
@ -354,7 +354,7 @@ void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle) {
}
}
if (handle->flags & UV_HANDLE_CLOSING &&
if (handle->flags & UV__HANDLE_CLOSING &&
handle->reqs_pending == 0) {
assert(!(handle->flags & UV_HANDLE_CLOSED));
@ -754,7 +754,7 @@ int uv_pipe_accept(uv_pipe_t* server, uv_stream_t* client) {
req->next_pending = NULL;
req->pipeHandle = INVALID_HANDLE_VALUE;
if (!(server->flags & UV_HANDLE_CLOSING)) {
if (!(server->flags & UV__HANDLE_CLOSING)) {
uv_pipe_queue_accept(loop, server, req, FALSE);
}
}
@ -1493,7 +1493,7 @@ void uv_process_pipe_accept_req(uv_loop_t* loop, uv_pipe_t* handle,
CloseHandle(req->pipeHandle);
req->pipeHandle = INVALID_HANDLE_VALUE;
}
if (!(handle->flags & UV_HANDLE_CLOSING)) {
if (!(handle->flags & UV__HANDLE_CLOSING)) {
uv_pipe_queue_accept(loop, handle, req, FALSE);
}
}

10
deps/uv/src/win/poll.c

@ -198,7 +198,7 @@ static void uv__fast_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle,
if ((handle->events & ~(handle->submitted_events_1 |
handle->submitted_events_2)) != 0) {
uv__fast_poll_submit_poll_req(loop, handle);
} else if ((handle->flags & UV_HANDLE_CLOSING) &&
} else if ((handle->flags & UV__HANDLE_CLOSING) &&
handle->submitted_events_1 == 0 &&
handle->submitted_events_2 == 0) {
uv_want_endgame(loop, (uv_handle_t*) handle);
@ -208,7 +208,7 @@ static void uv__fast_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle,
static int uv__fast_poll_set(uv_loop_t* loop, uv_poll_t* handle, int events) {
assert(handle->type == UV_POLL);
assert(!(handle->flags & UV_HANDLE_CLOSING));
assert(!(handle->flags & UV__HANDLE_CLOSING));
assert((events & ~(UV_READABLE | UV_WRITABLE)) == 0);
handle->events = events;
@ -445,7 +445,7 @@ static void uv__slow_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle,
if ((handle->events & ~(handle->submitted_events_1 |
handle->submitted_events_2)) != 0) {
uv__slow_poll_submit_poll_req(loop, handle);
} else if ((handle->flags & UV_HANDLE_CLOSING) &&
} else if ((handle->flags & UV__HANDLE_CLOSING) &&
handle->submitted_events_1 == 0 &&
handle->submitted_events_2 == 0) {
uv_want_endgame(loop, (uv_handle_t*) handle);
@ -455,7 +455,7 @@ static void uv__slow_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle,
static int uv__slow_poll_set(uv_loop_t* loop, uv_poll_t* handle, int events) {
assert(handle->type == UV_POLL);
assert(!(handle->flags & UV_HANDLE_CLOSING));
assert(!(handle->flags & UV__HANDLE_CLOSING));
assert((events & ~(UV_READABLE | UV_WRITABLE)) == 0);
handle->events = events;
@ -605,7 +605,7 @@ void uv_poll_close(uv_loop_t* loop, uv_poll_t* handle) {
void uv_poll_endgame(uv_loop_t* loop, uv_poll_t* handle) {
assert(handle->flags & UV_HANDLE_CLOSING);
assert(handle->flags & UV__HANDLE_CLOSING);
assert(!(handle->flags & UV_HANDLE_CLOSED));
assert(handle->submitted_events_1 == 0);

4
deps/uv/src/win/process.c

@ -689,7 +689,7 @@ void uv_process_proc_exit(uv_loop_t* loop, uv_process_t* handle) {
/* If we're closing, don't call the exit callback. Just schedule a close */
/* callback now. */
if (handle->flags & UV_HANDLE_CLOSING) {
if (handle->flags & UV__HANDLE_CLOSING) {
uv_want_endgame(loop, (uv_handle_t*) handle);
return;
}
@ -743,7 +743,7 @@ void uv_process_close(uv_loop_t* loop, uv_process_t* handle) {
void uv_process_endgame(uv_loop_t* loop, uv_process_t* handle) {
assert(!handle->exit_cb_pending);
assert(handle->flags & UV_HANDLE_CLOSING);
assert(handle->flags & UV__HANDLE_CLOSING);
assert(!(handle->flags & UV_HANDLE_CLOSED));
/* Clean-up the process handle. */

4
deps/uv/src/win/signal.c

@ -323,7 +323,7 @@ void uv_process_signal_req(uv_loop_t* loop, uv_signal_t* handle,
if (dispatched_signum == handle->signum)
handle->signal_cb(handle, dispatched_signum);
if (handle->flags & UV_HANDLE_CLOSING) {
if (handle->flags & UV__HANDLE_CLOSING) {
/* When it is closing, it must be stopped at this point. */
assert(handle->signum == 0);
uv_want_endgame(loop, (uv_handle_t*) handle);
@ -342,7 +342,7 @@ void uv_signal_close(uv_loop_t* loop, uv_signal_t* handle) {
void uv_signal_endgame(uv_loop_t* loop, uv_signal_t* handle) {
assert(handle->flags & UV_HANDLE_CLOSING);
assert(handle->flags & UV__HANDLE_CLOSING);
assert(!(handle->flags & UV_HANDLE_CLOSED));
assert(handle->signum == 0);

6
deps/uv/src/win/tcp.c

@ -164,7 +164,7 @@ void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle) {
UNREGISTER_HANDLE_REQ(loop, handle, handle->shutdown_req);
if (handle->flags & UV_HANDLE_CLOSING) {
if (handle->flags & UV__HANDLE_CLOSING) {
status = -1;
uv__set_artificial_error(loop, UV_ECANCELED);
} else if (shutdown(handle->socket, SD_SEND) != SOCKET_ERROR) {
@ -183,7 +183,7 @@ void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle) {
return;
}
if (handle->flags & UV_HANDLE_CLOSING &&
if (handle->flags & UV__HANDLE_CLOSING &&
handle->reqs_pending == 0) {
assert(!(handle->flags & UV_HANDLE_CLOSED));
@ -612,7 +612,7 @@ int uv_tcp_accept(uv_tcp_t* server, uv_tcp_t* client) {
req->next_pending = NULL;
req->accept_socket = INVALID_SOCKET;
if (!(server->flags & UV_HANDLE_CLOSING)) {
if (!(server->flags & UV__HANDLE_CLOSING)) {
/* Check if we're in a middle of changing the number of pending accepts. */
if (!(server->flags & UV_HANDLE_TCP_ACCEPT_STATE_CHANGING)) {
uv_tcp_queue_accept(server, req);

7
deps/uv/src/win/thread.c

@ -60,11 +60,6 @@ static NOINLINE void uv__once_inner(uv_once_t* guard,
void (*callback)(void)) {
DWORD result;
HANDLE existing_event, created_event;
HANDLE* event_ptr;
/* Fetch and align event_ptr */
event_ptr = (HANDLE*) (((uintptr_t) &guard->event + (sizeof(HANDLE) - 1)) &
~(sizeof(HANDLE) - 1));
created_event = CreateEvent(NULL, 1, 0, NULL);
if (created_event == 0) {
@ -72,7 +67,7 @@ static NOINLINE void uv__once_inner(uv_once_t* guard,
uv_fatal_error(GetLastError(), "CreateEvent");
}
existing_event = InterlockedCompareExchangePointer(event_ptr,
existing_event = InterlockedCompareExchangePointer(&guard->event,
created_event,
NULL);

4
deps/uv/src/win/threadpool.c

@ -68,7 +68,7 @@ int uv_queue_work(uv_loop_t* loop, uv_work_t* req, uv_work_cb work_cb,
void uv_process_work_req(uv_loop_t* loop, uv_work_t* req) {
assert(req->after_work_cb);
uv__req_unregister(loop, req);
req->after_work_cb(req);
if(req->after_work_cb)
req->after_work_cb(req);
}

2
deps/uv/src/win/timer.c

@ -76,7 +76,7 @@ int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) {
void uv_timer_endgame(uv_loop_t* loop, uv_timer_t* handle) {
if (handle->flags & UV_HANDLE_CLOSING) {
if (handle->flags & UV__HANDLE_CLOSING) {
assert(!(handle->flags & UV_HANDLE_CLOSED));
uv__handle_close(handle);
}

14
deps/uv/src/win/tty.c

@ -152,7 +152,7 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) {
memset(&tty->last_input_record, 0, sizeof tty->last_input_record);
} else {
/* TTY output specific fields. */
tty->flags |= UV_HANDLE_READABLE;
tty->flags |= UV_HANDLE_WRITABLE;
/* Init utf8-to-utf16 conversion state. */
tty->utf8_bytes_left = 0;
@ -1011,10 +1011,10 @@ static int uv_tty_reset(uv_tty_t* handle, DWORD* error) {
count = info.dwSize.X * info.dwSize.Y;
if (!(FillConsoleOutputCharacterW(handle->handle,
L'\x20',
count,
origin,
&written) &&
L'\x20',
count,
origin,
&written) &&
FillConsoleOutputAttribute(handle->handle,
char_attrs,
written,
@ -1813,7 +1813,7 @@ void uv_tty_endgame(uv_loop_t* loop, uv_tty_t* handle) {
/* TTY shutdown is really just a no-op */
if (handle->shutdown_req->cb) {
if (handle->flags & UV_HANDLE_CLOSING) {
if (handle->flags & UV__HANDLE_CLOSING) {
uv__set_artificial_error(loop, UV_ECANCELED);
handle->shutdown_req->cb(handle->shutdown_req, -1);
} else {
@ -1827,7 +1827,7 @@ void uv_tty_endgame(uv_loop_t* loop, uv_tty_t* handle) {
return;
}
if (handle->flags & UV_HANDLE_CLOSING &&
if (handle->flags & UV__HANDLE_CLOSING &&
handle->reqs_pending == 0) {
/* The console handle duplicate used for line reading should be destroyed */
/* by uv_tty_read_stop. */

2
deps/uv/src/win/udp.c

@ -152,7 +152,7 @@ void uv_udp_close(uv_loop_t* loop, uv_udp_t* handle) {
void uv_udp_endgame(uv_loop_t* loop, uv_udp_t* handle) {
if (handle->flags & UV_HANDLE_CLOSING &&
if (handle->flags & UV__HANDLE_CLOSING &&
handle->reqs_pending == 0) {
assert(!(handle->flags & UV_HANDLE_CLOSED));
uv__handle_close(handle);

10
deps/uv/test/test-fs.c

@ -19,9 +19,6 @@
* IN THE SOFTWARE.
*/
/* FIXME we shouldn't need to branch in this file */
#define UNIX (defined(__unix__) || defined(__POSIX__) || defined(__APPLE__))
#include "uv.h"
#include "task.h"
@ -30,8 +27,9 @@
#include <fcntl.h>
#include <sys/stat.h>
#if UNIX
/* FIXME we shouldn't need to branch in this file */
#if defined(__unix__) || defined(__POSIX__) || \
defined(__APPLE__) || defined(_AIX)
#include <unistd.h> /* unlink, rmdir, etc. */
#else
# include <direct.h>
@ -545,7 +543,7 @@ static void check_utime(const char* path, double atime, double mtime) {
ASSERT(req.result == 0);
s = req.ptr;
#if _WIN32
#if defined(_WIN32) || defined(_AIX)
ASSERT(s->st_atime == atime);
ASSERT(s->st_mtime == mtime);
#elif !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)

6
deps/uv/test/test-thread.c

@ -42,7 +42,7 @@ struct fs_req {
};
struct thread {
struct test_thread {
uv_thread_t thread_id;
volatile int thread_called;
};
@ -109,7 +109,7 @@ static void do_work(void* arg) {
uv_loop_t* loop;
size_t i;
int r;
struct thread* thread = arg;
struct test_thread* thread = arg;
loop = uv_loop_new();
ASSERT(loop != NULL);
@ -162,7 +162,7 @@ TEST_IMPL(thread_create) {
* that each "finished" callback is run in its originating thread.
*/
TEST_IMPL(threadpool_multiple_event_loops) {
struct thread threads[8];
struct test_thread threads[8];
size_t i;
int r;

21
deps/uv/uv.gyp

@ -190,6 +190,21 @@
],
},
}],
[ 'OS=="aix"', {
'include_dirs': [ 'src/ares/config_aix' ],
'sources': [ 'src/unix/aix.c' ],
'defines': [
'_ALL_SOURCE',
'_XOPEN_SOURCE=500',
'EV_CONFIG_H="config_aix.h"',
'EIO_CONFIG_H="config_aix.h"',
],
'direct_dependent_settings': {
'libraries': [
'-lperfstat',
],
},
}],
[ 'OS=="freebsd"', {
'sources': [ 'src/unix/freebsd.c' ],
'defines': [
@ -329,6 +344,12 @@
'_XOPEN_SOURCE=500',
],
}],
[ 'OS=="aix"', { # make test-fs.c compile, needs _POSIX_C_SOURCE
'defines': [
'_ALL_SOURCE',
'_XOPEN_SOURCE=500',
],
}],
],
'msvs-settings': {
'VCLinkerTool': {

Loading…
Cancel
Save