osx: Fix a possible segfault in uv__io_poll

In our build infrastructure, I've seen a lot of segfaults recently that
were all only happening on OSX. Upon inspecting the coredumps, it
appearded that all segfaults happened at the same instruction, and upon
translating the assembly back to the source, I found that an array could
be indexed with a -1 index before the index was checked to be not -1.

As concrete evidence, here is the situation that I found caused the
segfault.  The instruction in question along with the relevant register
values was:

    mov    (%r8,%r15,8),%r12

    r8  = 0x7fb0ba800000
    r15 = 0xffffffffffffffff

    r8 + r15 * 8 == 0x7fb0ba7ffff8

It appears that the base of loop->watchers was page aligned, and by
going back one word I guess that the page wasn't mapped, causing our
segfaults.
2014.01.08, Version 0.10.22 (Stable)

Changes since version 0.10.21:

* windows: avoid assertion failure when pipe server is closed (Bert
  Belder)
Now working on v0.10.23
windows: improved handling of invalid FDs

If passed and invalid FD, _get_osfhandle() sets an error code
through errno, not _doserrno. Hence we need to use
SET_REQ_WIN32_ERROR insted of SET_REQ_RESULT.

In debug builds, _get_osfhandle() also raises a superfluous
assert. I implemented a wrapper that disables all asserts
around the call to _get_osfhandle().

This fixes node.js unit tests test-fs-read-stream.js and
test-listen-fd-ebadf.js.
doc: adding ARCHS flag to OS X build command

Adding further instructions about building for OS X, as recent versions
of xcodebuild will automatically build for i386 (can someone say,
"monoculture") even on x86_64 machines! Specifically including
instructions about including the "ARCHS" flag to specify the right
architecture.

This is trivial, but will save people time.
tcp: reveal bind-time errors before listen

Changed uv_tcp_duplicate_socket to reveal any bind-time errors
before calling listen().

This fix is 100% windows specific.

It helps fix Node.js unite test test-cluster-bind-twice on Windows.
tcp: uv_tcp_dualstack()

Explicitly disable/enable dualstack depending on presence of flag set by
uv_tcp_dualstack() function.
linux: relax assumption on /proc/stat parsing

CPU entries in /proc/stat are not guaranteed to be monotonically
increasing, asserting on this assumption can break in cases such
as the UltraSparc II machine shown in #1080.

Signed-off-by: Luca Bruno <lucab@debian.org>
openbsd: fix obvious bug in uv_cpu_info

`int which[]` should not be static here, as the function itself is
changing it

fix joyent/node#6878
process: close stdio after dup2'ing it

Thus allow passing the same file descriptor as the source of multiple
stdios.

Committed with the help and code parts from:

  * Sam Roberts <sam@strongloop.com>

fix #1074
Merge branch 'v0.10'

Conflicts:
	ChangeLog
	src/unix/process.c
	src/version.c
test: fix after merge
2014.01.23, Version 0.10.23 (Stable)

Changes since version 0.10.22:

* linux: relax assumption on /proc/stat parsing (Luca Bruno)

* openbsd: fix obvious bug in uv_cpu_info (Fedor Indutny)

* process: close stdio after dup2'ing it (Fedor Indutny)
Now working on v0.10.24
linux: silence uninitialized variable warning

When building using gyp and BUILDTYPE=Release using clang 3.4 received
this warning:

../src/unix/linux-core.c:640:34: warning: variable 'n' is uninitialized
      for (len = sizeof("cpu0"); n /= 10; len++);
                                 ^

Initializing n = 0 silences this build warning.
Revert "linux: silence uninitialized variable warning"

This reverts commit 5008f8de08019af46ee844489ee9eeb18e5c7dd7.
linux: move sscanf() out of the assert()

If asserts are turned off then the sscanf() wouldn't have run, being
placed directly in the assert() itself.
authors: add two addresses to .mailmap, fix their name in AUTHORS
Merge tag 'v0.10.23'

Conflicts:
	AUTHORS
	src/version.c
2014.01.23, Version 0.11.18 (Unstable)

Changes since version 0.11.17:

* osx: Fix a possible segfault in uv__io_poll (Alex Crichton)

* windows: improved handling of invalid FDs (Alexis Campailla)

* doc: adding ARCHS flag to OS X build command (Nathan Sweet)

* tcp: reveal bind-time errors before listen (Alexis Campailla)

* tcp: uv_tcp_dualstack() (Fedor Indutny)

* linux: relax assumption on /proc/stat parsing (Luca Bruno)

* openbsd: fix obvious bug in uv_cpu_info (Fedor Indutny)

* process: close stdio after dup2'ing it (Fedor Indutny)

* linux: move sscanf() out of the assert() (Trevor Norris)