Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
uv: upgrade to 564e7c7
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Aug 21, 2012
1 parent 63d13e8 commit ed093f1
Show file tree
Hide file tree
Showing 13 changed files with 317 additions and 12 deletions.
3 changes: 3 additions & 0 deletions deps/uv/include/uv-private/uv-darwin.h
Expand Up @@ -34,4 +34,7 @@
int fflags; \
int fd; \

#define UV_STREAM_PRIVATE_PLATFORM_FIELDS \
void* select; \

#endif /* UV_DARWIN_H */
5 changes: 5 additions & 0 deletions deps/uv/include/uv-private/uv-unix.h
Expand Up @@ -79,6 +79,10 @@ struct uv__io_s {
# define UV_PLATFORM_FS_EVENT_FIELDS /* empty */
#endif

#ifndef UV_STREAM_PRIVATE_PLATFORM_FIELDS
# define UV_STREAM_PRIVATE_PLATFORM_FIELDS /* empty */
#endif

/* Note: May be cast to struct iovec. See writev(2). */
typedef struct {
char* base;
Expand Down Expand Up @@ -178,6 +182,7 @@ typedef struct {
int delayed_error; \
int accepted_fd; \
int fd; \
UV_STREAM_PRIVATE_PLATFORM_FIELDS \

#define UV_TCP_PRIVATE_FIELDS \
uv_idle_t* idle_handle; /* for UV_TCP_SINGLE_ACCEPT handles */ \
Expand Down
1 change: 1 addition & 0 deletions deps/uv/include/uv-private/uv-win.h
Expand Up @@ -65,6 +65,7 @@ typedef intptr_t ssize_t;
*/
#define SIGHUP 1
#define SIGKILL 9
#define SIGWINCH 28

/*
* Guids and typedefs for winsock extension functions
Expand Down
7 changes: 7 additions & 0 deletions deps/uv/include/uv.h
Expand Up @@ -1608,6 +1608,13 @@ UV_EXTERN int uv_fs_poll_stop(uv_fs_poll_t* handle);
* program is given approximately 10 seconds to perform cleanup. After that
* Windows will unconditionally terminate it.
*
* SIGWINCH is raised whenever libuv detects that the console has been
* resized. SIGWINCH is emulated by libuv when the program uses an uv_tty_t
* handle to write to the console. SIGWINCH may not always be delivered in a
* timely manner; libuv will only detect size changes when the cursor is
* being moved. When a readable uv_tty_handle is used in raw mode, resizing
* the console buffer will also trigger a SIGWINCH signal.
*
* Watchers for other signals can be successfully created, but these signals
* are never generated. These signals are: SIGILL, SIGABRT, SIGFPE, SIGSEGV,
* SIGTERM and SIGKILL.
Expand Down
12 changes: 8 additions & 4 deletions deps/uv/src/unix/core.c
Expand Up @@ -49,10 +49,14 @@

#ifdef __APPLE__
# include <mach-o/dyld.h> /* _NSGetExecutablePath */
# include <sys/filio.h>
# include <sys/ioctl.h>
#endif

#ifdef __FreeBSD__
# include <sys/sysctl.h>
# include <sys/filio.h>
# include <sys/ioctl.h>
# include <sys/wait.h>
#endif

Expand Down Expand Up @@ -459,7 +463,7 @@ int uv__accept(int sockfd) {

while (1) {
#if __linux__
static int no_accept4;
static __read_mostly int no_accept4;

if (no_accept4)
goto skip;
Expand Down Expand Up @@ -503,7 +507,7 @@ int uv__accept(int sockfd) {
}


#if __linux__
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)

int uv__nonblock(int fd, int set) {
int r;
Expand All @@ -526,7 +530,7 @@ int uv__cloexec(int fd, int set) {
return r;
}

#else /* !__linux__ */
#else /* !(defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)) */

int uv__nonblock(int fd, int set) {
int flags;
Expand Down Expand Up @@ -575,7 +579,7 @@ int uv__cloexec(int fd, int set) {
return r;
}

#endif /* __linux__ */
#endif /* defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) */


/* This function is not execve-safe, there is a race window
Expand Down
8 changes: 7 additions & 1 deletion deps/uv/src/unix/internal.h
Expand Up @@ -28,7 +28,13 @@
#include <assert.h>
#include <stdlib.h> /* abort */

#if __STRICT_ANSI__
#if defined(__GNUC__)
# define __read_mostly __attribute__((__section__(".data.read_mostly")))
#else
# define __read_mostly
#endif

#if defined(__STRICT_ANSI__)
# define inline __inline
#endif

Expand Down
4 changes: 2 additions & 2 deletions deps/uv/src/unix/linux/syscalls.c
Expand Up @@ -247,9 +247,9 @@ int uv__eventfd2(unsigned int count, int flags) {
}


int uv__epoll_create(void) {
int uv__epoll_create(int size) {
#if __NR_epoll_create
return syscall(__NR_epoll_create);
return syscall(__NR_epoll_create, size);
#else
return errno = ENOSYS, -1;
#endif
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/src/unix/linux/syscalls.h
Expand Up @@ -89,7 +89,7 @@ struct uv__mmsghdr {

int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags);
int uv__eventfd(unsigned int count);
int uv__epoll_create(void);
int uv__epoll_create(int size);
int uv__epoll_create1(int flags);
int uv__epoll_ctl(int epfd, int op, int fd, struct uv__epoll_event *ev);
int uv__epoll_wait(int epfd,
Expand Down
18 changes: 18 additions & 0 deletions deps/uv/src/unix/process.c
Expand Up @@ -117,6 +117,11 @@ static void uv__chld(uv_signal_t* handle, int signum) {

int uv__make_socketpair(int fds[2], int flags) {
#if __linux__
static __read_mostly int no_cloexec;

if (no_cloexec)
goto skip;

if (socketpair(AF_UNIX, SOCK_STREAM | UV__SOCK_CLOEXEC | flags, 0, fds) == 0)
return 0;

Expand All @@ -125,6 +130,10 @@ int uv__make_socketpair(int fds[2], int flags) {
*/
if (errno != EINVAL)
return -1;

no_cloexec = 1;

skip:
#endif

if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds))
Expand All @@ -144,11 +153,20 @@ int uv__make_socketpair(int fds[2], int flags) {

int uv__make_pipe(int fds[2], int flags) {
#if __linux__
static __read_mostly int no_pipe2;

if (no_pipe2)
goto skip;

if (uv__pipe2(fds, flags | UV__O_CLOEXEC) == 0)
return 0;

if (errno != ENOSYS)
return -1;

no_pipe2 = 1;

skip:
#endif

if (pipe(fds))
Expand Down

0 comments on commit ed093f1

Please sign in to comment.