Showing with 5,357 additions and 1,687 deletions.
  1. +27 −0 README.md
  2. +1 −0 deps/libuv/.mailmap
  3. +5 −0 deps/libuv/AUTHORS
  4. +48 −6 deps/libuv/{README → README.md}
  5. +51 −51 deps/libuv/common.gypi
  6. +11 −2 deps/libuv/config-unix.mk
  7. +29 −0 deps/libuv/include/uv-private/uv-linux.h
  8. +12 −2 deps/libuv/include/uv-private/uv-unix.h
  9. +19 −7 deps/libuv/include/uv-private/uv-win.h
  10. +99 −13 deps/libuv/include/uv.h
  11. +510 −0 deps/libuv/src/ares/config_netbsd/ares_config.h
  12. +40 −48 deps/libuv/src/unix/core.c
  13. +16 −0 deps/libuv/src/unix/cygwin.c
  14. +19 −0 deps/libuv/src/unix/darwin.c
  15. +81 −0 deps/libuv/src/unix/eio/config_netbsd.h
  16. +7 −1 deps/libuv/src/unix/error.c
  17. +120 −0 deps/libuv/src/unix/ev/config_netbsd.h
  18. +18 −1 deps/libuv/src/unix/freebsd.c
  19. +159 −21 deps/libuv/src/unix/fs.c
  20. +54 −0 deps/libuv/src/unix/internal.h
  21. +133 −1 deps/libuv/src/unix/linux.c
  22. +85 −0 deps/libuv/src/unix/netbsd.c
  23. +20 −30 deps/libuv/src/unix/pipe.c
  24. +13 −0 deps/libuv/src/unix/process.c
  25. +122 −67 deps/libuv/src/unix/stream.c
  26. +18 −1 deps/libuv/src/unix/sunos.c
  27. +27 −21 deps/libuv/src/unix/tcp.c
  28. +110 −0 deps/libuv/src/unix/tty.c
  29. +7 −0 deps/libuv/src/unix/udp.c
  30. +2 −0 deps/libuv/src/uv-common.c
  31. +0 −6 deps/libuv/src/uv-common.h
  32. +7 −7 deps/libuv/src/win/cares.c
  33. +25 −17 deps/libuv/src/win/core.c
  34. +5 −0 deps/libuv/src/win/error.c
  35. +384 −0 deps/libuv/src/win/fs-event.c
  36. +468 −86 deps/libuv/src/win/fs.c
  37. +10 −3 deps/libuv/src/win/getaddrinfo.c
  38. +8 −0 deps/libuv/src/win/handle.c
  39. +23 −0 deps/libuv/src/win/internal.h
  40. +6 −0 deps/libuv/src/win/pipe.c
  41. +97 −45 deps/libuv/src/win/process.c
  42. +4 −0 deps/libuv/src/win/req.c
  43. +16 −4 deps/libuv/src/win/tcp.c
  44. +81 −0 deps/libuv/src/win/threads.c
  45. +15 −15 deps/libuv/src/win/timer.c
  46. +61 −0 deps/libuv/src/win/tty.c
  47. +5 −0 deps/libuv/src/win/udp.c
  48. +4 −0 deps/libuv/src/win/winapi.c
  49. +1,131 −1,015 deps/libuv/src/win/winapi.h
  50. +0 −1 deps/libuv/test/benchmark-ares.c
  51. +2 −1 deps/libuv/test/benchmark-getaddrinfo.c
  52. +0 −1 deps/libuv/test/benchmark-ping-pongs.c
  53. +0 −1 deps/libuv/test/benchmark-pound.c
  54. +4 −6 deps/libuv/test/benchmark-pump.c
  55. +0 −1 deps/libuv/test/benchmark-spawn.c
  56. +0 −1 deps/libuv/test/benchmark-udp-packet-storm.c
  57. +2 −2 deps/libuv/test/dns-server.c
  58. +4 −5 deps/libuv/test/echo-server.c
  59. +0 −2 deps/libuv/test/run-tests.c
  60. +2 −0 deps/libuv/test/runner-unix.c
  61. +0 −2 deps/libuv/test/test-async.c
  62. +0 −2 deps/libuv/test/test-callback-stack.c
  63. +3 −5 deps/libuv/test/test-connection-fail.c
  64. +2 −3 deps/libuv/test/test-delayed-accept.c
  65. +217 −0 deps/libuv/test/test-fs-event.c
  66. +463 −39 deps/libuv/test/test-fs.c
  67. +12 −2 deps/libuv/test/test-get-currentexe.c
  68. +17 −8 deps/libuv/test/test-getaddrinfo.c
  69. +0 −2 deps/libuv/test/test-gethostbyname.c
  70. +2 −3 deps/libuv/test/test-getsockname.c
  71. +0 −3 deps/libuv/test/test-idle.c
  72. +22 −0 deps/libuv/test/test-list.h
  73. +0 −3 deps/libuv/test/test-loop-handles.c
  74. +13 −19 deps/libuv/test/test-ping-pong.c
  75. +0 −12 deps/libuv/test/test-pipe-bind-error.c
  76. +0 −7 deps/libuv/test/test-ref.c
  77. +3 −3 deps/libuv/test/test-shutdown-eof.c
  78. +2 −11 deps/libuv/test/test-spawn.c
  79. +0 −19 deps/libuv/test/test-tcp-bind-error.c
  80. +0 −15 deps/libuv/test/test-tcp-bind6-error.c
  81. +129 −0 deps/libuv/test/test-tcp-close.c
  82. +154 −0 deps/libuv/test/test-tcp-write-error.c
  83. +0 −3 deps/libuv/test/test-tcp-writealot.c
  84. +0 −2 deps/libuv/test/test-threadpool.c
  85. +0 −3 deps/libuv/test/test-timer-again.c
  86. +0 −2 deps/libuv/test/test-timer.c
  87. +56 −0 deps/libuv/test/test-tty.c
  88. +0 −2 deps/libuv/test/test-udp-dgram-too-big.c
  89. +0 −2 deps/libuv/test/test-udp-ipv6.c
  90. +0 −2 deps/libuv/test/test-udp-send-and-recv.c
  91. +35 −20 deps/libuv/uv.gyp
  92. +0 −2 src/ext.c
@@ -0,0 +1,27 @@
# phode

php + libuv = win

## status

Very alpha. And not in the dominating male / leader of the pack sense.

## how to build

Make sure you have the PHP 5.4 header files installed somewhere.

$ cp local.gypi.example local.gypi
$ vi local.gypi # update include paths
$ tools/gyp/gyp -Dlibrary=shared_library
$ make

Add the following line to your `php.ini`.

extension = /path/to/phode/out/Debug/obj.target/libphode.so

Now try out some of the examples in the `test/` directory.

$ php test/test-tcp-ping-pong.php
Segmentation fault.

The beauty of open source!
@@ -5,3 +5,4 @@
<bertbelder@gmail.com> <info@2bs.nl>
<alan@prettyrobots.com> <alan@blogometer.com>
San-Tai Hsu <vanilla@fatpipi.com>
Isaac Z. Schlueter <i@izs.me>
@@ -19,3 +19,8 @@ Andrea Lattuada <ndr.lattuada@gmail.com>
Augusto Henrique Hentz <ahhentz@gmail.com>
Clifford Heath <clifford.heath@gmail.com>
Jorge Chamorro Bieling <jorge@jorgechamorro.com>
Luis Lavena <luislavena@gmail.com>
Matthew Sporleder <msporleder@gmail.com>
Erick Tryzelaar <erick.tryzelaar@gmail.com>
Isaac Z. Schlueter <i@izs.me>
Pieter Noordhuis <pcnoordhuis@gmail.com>
@@ -1,10 +1,52 @@
This is the new networking layer for Node. Its purpose is to abstract
IOCP on windows and libev on Unix systems. We intend to eventually contain
all platform differences in this library.
# libuv

libuv is a new platform layer for Node. Its purpose is to abstract IOCP on
windows and libev on Unix systems. We intend to eventually contain all
platform differences in this library.

http://nodejs.org/

= Build Instructions
## Features

Implemented:

* Non-blocking TCP sockets

* Non-blocking named pipes

* UDP

* Timers

* Child process spawning

* Asynchronous DNS via c-ares or `uv_getaddrinfo`.

* Asynchronous file system APIs `uv_fs_*`

* High resolution time `uv_hrtime`

* Current executable path look up `uv_exepath`

* Thread pool scheduling `uv_queue_work`

In-progress:

* File system events (Currently supports inotify, `ReadDirectoryChangesW`
and will support kqueue and event ports in the near future.)
`uv_fs_event_t`

* VT100 TTY `uv_tty_t`

* Socket sharing between processes `uv_ipc_t`


## Documentation

See `include/uv.h`.


## Build Instructions

For GCC (including MinGW) there are two methods building: via normal
makefiles or via GYP. GYP is a meta-build system which can generate MSVS,
@@ -19,7 +61,7 @@ To build with Visual Studio run the vcbuilds.bat file which will
checkout the GYP code into build/gyp and generate the uv.sln and
related files.

Windows users can also build from cmd-line using msbuild. This is
Windows users can also build from cmd-line using msbuild. This is
done by running vcbuild.bat from Visual Studio command prompt.

To have GYP generate build script for another system you will need to
@@ -38,7 +80,7 @@ Macintosh users run
xcodebuild -project uv.xcodeproj -configuration Release -target All


= Supported Platforms
## Supported Platforms

Microsoft Windows operating systems since Windows XP SP2. It can be built
with either Visual Studio or MinGW.
@@ -1,5 +1,6 @@
{
'variables': {
'visibility%': 'hidden', # V8's visibility setting
'target_arch%': 'ia32', # set v8's target architecture
'host_arch%': 'ia32', # set v8's host architecture
'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
@@ -87,6 +88,11 @@
'DataExecutionPrevention': 2, # enable DEP
'AllowIsolation': 'true',
'SuppressStartupBanner': 'true',
'target_conditions': [
['_type=="executable"', {
'SubSystem': 1, # console executable
}],
],
},
},
'conditions': [
@@ -103,61 +109,55 @@
],
}],
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
'target_defaults': {
'cflags': [ '-Wall', '-pthread', '-fno-rtti', '-fno-exceptions' ],
'ldflags': [ '-pthread', ],
'conditions': [
[ 'target_arch=="ia32"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
[ 'OS=="linux"', {
'cflags': [ '-ansi' ],
}],
[ 'visibility=="hidden"', {
'cflags': [ '-fvisibility=hidden' ],
}],
],
},
'cflags': [ '-Wall', '-pthread', ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
'ldflags': [ '-pthread', ],
'conditions': [
[ 'host_arch != target_arch and target_arch=="ia32"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
[ 'OS=="linux"', {
'cflags': [ '-ansi' ],
}],
[ 'visibility=="hidden"', {
'cflags': [ '-fvisibility=hidden' ],
}],
],
}],
['OS=="mac"', {
'target_defaults': {
'xcode_settings': {
'ALWAYS_SEARCH_USER_PATHS': 'NO',
'GCC_C_LANGUAGE_STANDARD': 'ansi', # -ansi
'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
# (Equivalent to -fPIC)
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
# GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', # -Werror
'GCC_VERSION': '4.2',
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4
'PREBINDING': 'NO', # No -Wl,-prebind
'USE_HEADERMAP': 'NO',
'OTHER_CFLAGS': [
'-fno-strict-aliasing',
],
'WARNING_CFLAGS': [
'-Wall',
'-Wendif-labels',
'-W',
'-Wno-unused-parameter',
'-Wnon-virtual-dtor',
],
},
'target_conditions': [
['_type!="static_library"', {
'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
}],
'xcode_settings': {
'ALWAYS_SEARCH_USER_PATHS': 'NO',
'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
# (Equivalent to -fPIC)
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
# GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
'GCC_VERSION': '4.2',
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4
'PREBINDING': 'NO', # No -Wl,-prebind
'USE_HEADERMAP': 'NO',
'OTHER_CFLAGS': [
'-fno-strict-aliasing',
],
'WARNING_CFLAGS': [
'-Wall',
'-Wendif-labels',
'-W',
'-Wno-unused-parameter',
],
},
'target_conditions': [
['_type!="static_library"', {
'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
}],
],
}],
],
},
@@ -22,7 +22,7 @@ CC = $(PREFIX)gcc
AR = $(PREFIX)ar
E=
CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
CFLAGS=-g
CFLAGS += -g
CPPFLAGS += -Isrc/unix/ev
LINKFLAGS=-lm

@@ -37,6 +37,7 @@ OBJS += src/unix/error.o
OBJS += src/unix/process.o
OBJS += src/unix/tcp.o
OBJS += src/unix/pipe.o
OBJS += src/unix/tty.o
OBJS += src/unix/stream.o

ifeq (SunOS,$(uname_S))
@@ -58,7 +59,7 @@ endif
ifeq (Linux,$(uname_S))
EV_CONFIG=config_linux.h
EIO_CONFIG=config_linux.h
CSTDFLAG += -D_XOPEN_SOURCE=600
CSTDFLAG += -D_GNU_SOURCE
CPPFLAGS += -Isrc/ares/config_linux
LINKFLAGS+=-lrt
OBJS += src/unix/linux.o
@@ -72,6 +73,14 @@ LINKFLAGS+=
OBJS += src/unix/freebsd.o
endif

ifeq (NetBSD,$(uname_S))
EV_CONFIG=config_netbsd.h
EIO_CONFIG=config_netbsd.h
CPPFLAGS += -Isrc/ares/config_netbsd
LINKFLAGS+=
OBJS += src/unix/netbsd.o
endif

ifneq (,$(findstring CYGWIN,$(uname_S)))
EV_CONFIG=config_cygwin.h
EIO_CONFIG=config_cygwin.h
@@ -0,0 +1,29 @@
/* 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.
*/

#ifndef UV_LINUX_H
#define UV_LINUX_H

#define UV_FS_EVENT_PRIVATE_FIELDS \
ev_io read_watcher; \
uv_fs_event_cb cb; \

#endif /* UV_LINUX_H */
@@ -27,6 +27,10 @@
#include "ev.h"
#include "eio.h"

#if defined(__linux__)
#include "uv-private/uv-linux.h"
#endif

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
@@ -42,6 +46,11 @@ typedef struct {

typedef int uv_file;

/* Stub. Remove it once all platforms support the file watcher API. */
#ifndef UV_FS_EVENT_PRIVATE_FIELDS
#define UV_FS_EVENT_PRIVATE_FIELDS /* empty */
#endif

#define UV_LOOP_PRIVATE_FIELDS \
ares_channel channel; \
/* \
@@ -61,6 +70,7 @@ typedef int uv_file;
int write_index; \
uv_buf_t* bufs; \
int bufcnt; \
int error; \
uv_buf_t bufsml[UV_REQ_BUFSML_SIZE];

#define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */
@@ -117,9 +127,7 @@ typedef int uv_file;


/* UV_NAMED_PIPE */
#define UV_PIPE_PRIVATE_TYPEDEF
#define UV_PIPE_PRIVATE_FIELDS \
UV_TCP_PRIVATE_FIELDS \
const char* pipe_fname; /* strdup'ed */


@@ -175,4 +183,6 @@ typedef int uv_file;
#define UV_WORK_PRIVATE_FIELDS \
eio_req* eio;

#define UV_TTY_PRIVATE_FIELDS /* empty */

#endif /* UV_UNIX_H */