Showing with 11,955 additions and 6,097 deletions.
  1. +24 −3 .gitignore
  2. +2 −0 .mailmap
  3. +13 −1 AUTHORS
  4. +174 −0 CONTRIBUTING.md
  5. +602 −3 ChangeLog
  6. +3 −2 LICENSE
  7. +288 −0 Makefile.am
  8. +77 −0 Makefile.mingw
  9. +65 −57 README.md
  10. +20 −0 android-configure
  11. +46 −0 autogen.sh
  12. +0 −169 build.mk
  13. +11 −13 checksparse.sh
  14. +3 −2 common.gypi
  15. +0 −207 config-unix.mk
  16. +50 −0 configure.ac
  17. +59 −0 include/pthread-fixes.h
  18. 0 include/{uv-private → }/stdint-msvc2008.h
  19. 0 include/{uv-private → }/tree.h
  20. 0 include/{uv-private → }/uv-bsd.h
  21. +8 −6 include/{uv-private → }/uv-darwin.h
  22. +373 −0 include/uv-errno.h
  23. +3 −1 include/{uv-private → }/uv-linux.h
  24. +0 −129 include/uv-private/ngx-queue.h
  25. 0 include/{uv-private → }/uv-sunos.h
  26. +32 −35 include/{uv-private → }/uv-unix.h
  27. +9 −5 include/{uv-private → }/uv-win.h
  28. +383 −278 include/uv.h
  29. +2 −0 m4/.gitignore
  30. +58 −0 m4/dtrace.m4
  31. +3 −29 config-mingw.mk → samples/.gitignore
  32. +21 −0 samples/socks5-proxy/.gitignore
  33. +53 −0 samples/socks5-proxy/LICENSE
  34. +21 −28 { → samples/socks5-proxy}/Makefile
  35. +46 −0 samples/socks5-proxy/build.gyp
  36. +737 −0 samples/socks5-proxy/client.c
  37. +139 −0 samples/socks5-proxy/defs.h
  38. +131 −0 samples/socks5-proxy/getopt.c
  39. +99 −0 samples/socks5-proxy/main.c
  40. +271 −0 samples/socks5-proxy/s5.c
  41. +94 −0 samples/socks5-proxy/s5.h
  42. +241 −0 samples/socks5-proxy/server.c
  43. +72 −0 samples/socks5-proxy/util.c
  44. +21 −46 src/fs-poll.c
  45. +38 −42 src/inet.c
  46. +92 −0 src/queue.h
  47. +58 −50 src/unix/aix.c
  48. +27 −18 src/unix/async.c
  49. +60 −0 src/unix/atomic-ops.h
  50. +156 −109 src/unix/core.c
  51. +0 −88 src/unix/cygwin.c
  52. +143 −63 src/unix/darwin-proctitle.c
  53. +76 −189 src/unix/darwin.c
  54. +1 −1 src/unix/dl.c
  55. +0 −110 src/unix/error.c
  56. +139 −57 src/unix/freebsd.c
  57. +121 −25 src/unix/fs.c
  58. +751 −151 src/unix/fsevents.c
  59. +15 −39 src/unix/getaddrinfo.c
  60. +56 −27 src/unix/internal.h
  61. +56 −27 src/unix/kqueue.c
  62. +121 −68 src/unix/linux-core.c
  63. +62 −41 src/unix/linux-inotify.c
  64. +1 −0 src/unix/linux-syscalls.h
  65. +6 −7 src/unix/loop-watcher.c
  66. +69 −20 src/unix/loop.c
  67. +77 −63 src/unix/netbsd.c
  68. +134 −50 src/unix/openbsd.c
  69. +59 −104 src/unix/pipe.c
  70. +1 −2 src/unix/poll.c
  71. +132 −132 src/unix/process.c
  72. +6 −7 src/unix/proctitle.c
  73. +80 −0 src/unix/pthread-fixes.c
  74. +29 −23 src/unix/signal.c
  75. +53 −0 src/unix/spinlock.h
  76. +281 −224 src/unix/stream.c
  77. +180 −121 src/unix/sunos.c
  78. +86 −145 src/unix/tcp.c
  79. +105 −72 src/unix/thread.c
  80. +31 −37 src/unix/threadpool.c
  81. +1 −1 src/unix/timer.c
  82. +37 −32 src/unix/tty.c
  83. +119 −233 src/unix/udp.c
  84. +209 −196 src/uv-common.c
  85. +23 −44 src/uv-common.h
  86. +2 −5 src/version.c
  87. +3 −3 src/win/async.c
  88. +31 −17 src/win/core.c
  89. +8 −3 src/win/error.c
  90. +89 −69 src/win/fs-event.c
  91. +193 −125 src/win/fs.c
  92. +16 −37 src/win/getaddrinfo.c
  93. +1 −1 src/win/handle-inl.h
  94. +2 −1 src/win/handle.c
  95. +23 −9 src/win/internal.h
  96. +1 −1 src/win/loop-watcher.c
  97. +184 −106 src/win/pipe.c
  98. +30 −20 src/win/poll.c
  99. +27 −28 src/win/process-stdio.c
  100. +133 −123 src/win/process.c
  101. +12 −14 src/win/signal.c
  102. +6 −6 src/win/stream-inl.h
  103. +92 −45 src/win/stream.c
  104. +214 −241 src/win/tcp.c
  105. +79 −29 src/win/thread.c
  106. +3 −4 src/win/threadpool.c
  107. +29 −11 src/win/timer.c
  108. +72 −56 src/win/tty.c
  109. +162 −156 src/win/udp.c
  110. +114 −80 src/win/util.c
  111. +13 −6 src/win/winapi.c
  112. +213 −41 src/win/winapi.h
  113. +18 −12 src/win/winsock.c
  114. +3 −1 test/benchmark-async.c
  115. +14 −6 test/benchmark-million-timers.c
  116. +29 −17 test/benchmark-multi-accept.c
  117. +29 −23 test/benchmark-ping-pongs.c
  118. +51 −26 test/benchmark-pound.c
  119. +41 −30 test/benchmark-pump.c
  120. +11 −11 test/benchmark-spawn.c
  121. +5 −2 test/benchmark-tcp-write-batch.c
  122. +21 −16 test/benchmark-udp-pummel.c
  123. +12 −9 test/blackhole-server.c
  124. +35 −24 test/dns-server.c
  125. +40 −40 test/echo-server.c
  126. +1 −1 test/runner-unix.c
  127. +14 −3 test/runner-win.c
  128. +2 −1 test/runner.c
  129. +62 −1 test/task.h
  130. +11 −10 test/test-active.c
  131. +22 −64 test/{test-util.c → test-async-null-cb.c}
  132. +15 −13 test/test-callback-stack.c
  133. +77 −0 test/test-close-fd.c
  134. +80 −0 test/test-close-order.c
  135. +1 −1 test/test-condvar.c
  136. +10 −8 test/test-connection-fail.c
  137. +4 −4 test/test-cwd-and-chdir.c
  138. +17 −16 test/test-delayed-accept.c
  139. +4 −1 test/test-embed.c
  140. +6 −3 test/test-emfile.c
  141. +4 −13 test/test-error.c
  142. +273 −47 test/test-fs-event.c
  143. +8 −10 test/test-fs-poll.c
  144. +262 −207 test/test-fs.c
  145. +5 −3 test/test-get-currentexe.c
  146. +29 −0 test/test-getaddrinfo.c
  147. +39 −25 test/test-getsockname.c
  148. +19 −2 test/test-idle.c
  149. +99 −0 test/test-ip6-addr.c
  150. +19 −11 test/test-ipc-send-recv.c
  151. +83 −60 test/test-ipc.c
  152. +20 −4 test/test-list.h
  153. +1 −1 test/test-loop-stop.c
  154. +10 −4 test/test-multiple-listen.c
  155. +5 −5 test/test-osx-select.c
  156. +32 −19 test/test-ping-pong.c
  157. +7 −15 test/test-pipe-bind-error.c
  158. +2 −5 test/test-pipe-connect-error.c
  159. +22 −6 test/test-platform-output.c
  160. +1 −1 test/test-poll-close.c
  161. +13 −7 test/test-poll.c
  162. +4 −4 test/test-process-title.c
  163. +38 −10 test/test-ref.c
  164. +2 −2 test/test-semaphore.c
  165. +9 −6 test/test-shutdown-close.c
  166. +15 −17 test/test-shutdown-eof.c
  167. +38 −19 test/test-signal-multiple-loops.c
  168. +97 −89 test/test-spawn.c
  169. +21 −16 test/test-stdio-over-pipes.c
  170. +31 −30 test/test-tcp-bind-error.c
  171. +27 −25 test/test-tcp-bind6-error.c
  172. +15 −9 test/test-tcp-close-accept.c
  173. +6 −5 test/test-tcp-close-while-connecting.c
  174. +9 −3 test/test-tcp-close.c
  175. +8 −6 test/test-tcp-connect-error-after-write.c
  176. +9 −7 test/test-tcp-connect-error.c
  177. +6 −3 test/test-tcp-connect-timeout.c
  178. +9 −7 test/test-tcp-connect6-error.c
  179. +17 −10 test/test-tcp-open.c
  180. +5 −2 test/test-tcp-read-stop.c
  181. +11 −5 test/test-tcp-shutdown-after-write.c
  182. +10 −7 test/test-tcp-unexpected-read.c
  183. +16 −11 test/test-tcp-write-to-half-open-connection.c
  184. +14 −9 test/test-tcp-writealot.c
  185. +26 −0 test/test-thread.c
  186. +5 −5 test/test-threadpool-cancel.c
  187. +1 −2 test/test-threadpool.c
  188. +3 −5 test/test-timer-again.c
  189. +32 −4 test/test-timer.c
  190. +6 −2 test/test-tty.c
  191. +9 −5 test/test-udp-dgram-too-big.c
  192. +19 −11 test/test-udp-ipv6.c
  193. +19 −11 test/test-udp-multicast-join.c
  194. +10 −3 test/test-udp-multicast-ttl.c
  195. +19 −9 test/test-udp-open.c
  196. +6 −5 test/test-udp-options.c
  197. +25 −24 test/test-udp-send-and-recv.c
  198. +15 −22 test/test-watcher-cross-stop.c
  199. +58 −30 uv.gyp
@@ -9,12 +9,33 @@
core
vgcore.*
.buildstamp

/libuv.so
.dirstamp
.deps/
/.libs/
/aclocal.m4
/ar-lib
/autom4te.cache/
/compile
/config.guess
/config.log
/config.status
/config.sub
/configure
/depcomp
/install-sh
/libtool
/libuv.a
/libuv.dylib
/libuv.pc
/libuv.so
/ltmain.sh
/missing
/test-driver
Makefile
Makefile.in

# Generated by dtrace(1) when doing an in-tree build.
/src/unix/uv-dtrace.h
/include/uv-dtrace.h

/out/
/build/gyp
@@ -6,6 +6,8 @@ Brian White <mscdex@mscdex.net>
Brian White <mscdex@mscdex.net> <mscdex@gmail.com>
Frank Denis <github@pureftpd.org>
Isaac Z. Schlueter <i@izs.me>
Keno Fischer <kenof@stanford.edu> <kfischer+github@college.harvard.edu>
Keno Fischer <kenof@stanford.edu> <kfischer@college.harvard.edu>
Robert Mustacchi <rm@joyent.com> <rm@fingolfin.org>
Ryan Dahl <ryan@joyent.com> <ry@tinyclouds.org>
Ryan Emery <seebees@gmail.com>
14 AUTHORS
@@ -79,11 +79,23 @@ Tim Bradshaw <tfb@cley.com>
Timothy J. Fontaine <tjfontaine@gmail.com>
Marc Schlaich <marc.schlaich@googlemail.com>
Brian Mazza <louseman@gmail.com>
Elliot Saba <staticfloat@gmail.com>
Ben Kelly <ben@wanderview.com>
Kristian Evensen <kristian.evensen@gmail.com>
Nils Maier <maierman@web.de>
Nicholas Vavilov <vvnicholas@gmail.com>
Miroslav Bajtoš <miro.bajtos@gmail.com>
Elliot Saba <staticfloat@gmail.com>
Sean Silva <chisophugis@gmail.com>
Wynn Wilkes <wynnw@movenetworks.com>
Linus Mårtensson <linus.martensson@sonymobile.com>
Andrei Sedoi <bsnote@gmail.com>
Navaneeth Kedaram Nambiathan <navaneethkn@gmail.com>
Alex Crichton <alex@alexcrichton.com>
Brent Cook <brent@boundary.com>
Brian Kaisner <bkize1@gmail.com>
Luca Bruno <lucab@debian.org>
Reini Urban <rurban@cpanel.net>
Maks Naumov <maksqwe1@ukr.net>
Sean Farrell <sean.farrell@rioki.org>
Chris Bank <cbank@adobe.com>
Geert Jansen <geertj@gmail.com>
@@ -0,0 +1,174 @@
# CONTRIBUTING

The libuv project welcomes new contributors. This document will guide you
through the process.


### FORK

Fork the project [on GitHub](https://github.com/joyent/libuv) and check out
your copy.

```
$ git clone git@github.com:username/libuv.git
$ cd libuv
$ git remote add upstream git://github.com/joyent/libuv.git
```

Now decide if you want your feature or bug fix to go into the master branch
or the stable branch. As a rule of thumb, bug fixes go into the stable branch
while new features go into the master branch.

The stable branch is effectively frozen; patches that change the libuv
API/ABI or affect the run-time behavior of applications get rejected.

In case of doubt, open an issue in the [issue tracker][], post your question
to the [libuv mailing list], or contact one of project maintainers
(@bnoordhuis, @piscisaureus, @indutny or @saghul) on [IRC][].

Especially do so if you plan to work on something big. Nothing is more
frustrating than seeing your hard work go to waste because your vision
does not align with that of a project maintainers.


### BRANCH

Okay, so you have decided on the proper branch. Create a feature branch
and start hacking:

```
$ git checkout -b my-feature-branch -t origin/v0.10
```

(Where v0.10 is the latest stable branch as of this writing.)

### CODE

Please adhere to libuv's code style. In general it follows the conventions from
the [Google C/C++ style guide]. Some of they key points are reiterated below.

* Code that is specific to unix-y platforms should be places in `src/unix`, and
declarations go into `src/uv-unix.h`.

* Source code that is windows-specific goes into `src/win`, and related
publicly exported types, functions and macro declarations should generally
be declared in `include/uv-win.h`.

* Names should be descriptive and concise.

* All the symbols and types that libuv makes available publicly should be
prefixed with `uv_` (or `UV_` in case of macros).

* Internal, non-static functions should be prefixed with `uv__`.

* Use two spaces and no tabs.

* Lines should be wrapped at 80 characters.

* Ensure that lines have no trailing whitespace, and use unix-style (LF) line
endings.

* Use C89-compliant syntax. In other words, variables can only be declared at
the top of a scope (function, if/for/while-block).

* When writing comments, use properly constructed sentences, including
punctuation.

* When documenting APIs and/or source code, don't make assumptions or make
implications about race, gender, religion, political orientation or anything
else that isn't relevant to the project.

* Remember that source code usually gets written once and read often: ensure
the reader doesn't have to make guesses. Make sure that the purpose and inner
logic are either obvious to a reasonably skilled professional, or add a
comment that explains it.


### COMMIT

Make sure git knows your name and email address:

```
$ git config --global user.name "J. Random User"
$ git config --global user.email "j.random.user@example.com"
```

Writing good commit logs is important. A commit log should describe what
changed and why. Follow these guidelines when writing one:

1. The first line should be 50 characters or less and contain a short
description of the change prefixed with the name of the changed
subsystem (e.g. "net: add localAddress and localPort to Socket").
2. Keep the second line blank.
3. Wrap all other lines at 72 columns.

A good commit log looks like this:

```
subsystem: explaining the commit in one line
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.
The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
72 characters or so. That way `git log` will show things
nicely even when it is indented.
```

The header line should be meaningful; it is what other people see when they
run `git shortlog` or `git log --oneline`.

Check the output of `git log --oneline files_that_you_changed` to find out
what subsystem (or subsystems) your changes touch.


### REBASE

Use `git rebase` (not `git merge`) to sync your work from time to time.

```
$ git fetch upstream
$ git rebase upstream/v0.10 # or upstream/master
```


### TEST

Bug fixes and features should come with tests. Add your tests in the
`test/` directory. Tests also need to be registered in `test/test-list.h`.
Look at other tests to see how they should be structured (license boilerplate,
the way entry points are declared, etc.).

```
$ make test
```

Make sure that there are no test regressions.

### PUSH

```
$ git push origin my-feature-branch
```

Go to https://github.com/username/libuv and select your feature branch. Click
the 'Pull Request' button and fill out the form.

Pull requests are usually reviewed within a few days. If there are comments
to address, apply your changes in a separate commit and push that to your
feature branch. Post a comment in the pull request afterwards; GitHub does
not send out notifications when you add commits.


### CONTRIBUTOR LICENSE AGREEMENT

Please visit http://libuvjs.org/cla.html and sign the Contributor License
Agreement. You only need to do that once.


[issue tracker]: https://github.com/joyent/libuv/issues
[libuv mailing list]: http://groups.google.com/group/libuv
[IRC]: http://webchat.freelibuv.net/?channels=libuv
[Google C/C++ style guide]: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml