Permalink
Browse files

uv: upgrade to 564e7c7

  • Loading branch information...
1 parent 63d13e8 commit ed093f1314807f55a472838eb82bb532768b0e79 @piscisaureus piscisaureus committed Aug 21, 2012
@@ -34,4 +34,7 @@
int fflags; \
int fd; \
+#define UV_STREAM_PRIVATE_PLATFORM_FIELDS \
+ void* select; \
+
#endif /* UV_DARWIN_H */
@@ -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;
@@ -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 */ \
@@ -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
@@ -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.
@@ -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
@@ -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;
@@ -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;
@@ -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;
@@ -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
@@ -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
@@ -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
@@ -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,
@@ -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;
@@ -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))
@@ -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))
Oops, something went wrong. Retry.

0 comments on commit ed093f1

Please sign in to comment.