fs: fix symlink error message

the arguments were swapped, so fs.symlink{Sync,} would
report that the wrong file EEXIST'd in error.

Fixes: https://github.com/joyent/node/issues/8651
Fixes: https://github.com/joyent/node/issues/4314
Fixes: https://github.com/joyent/node/issues/5381
PR-URL: https://github.com/joyent/node/pull/8657
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
process: pid can be a string in process.kill()

Not allowing string was a change from v0.10 behaviour, commented on in
joyent/node#7991. Allow them again, but still check that argument is
numberish. Also, simplify the fragile and non-portable test code
introduced in 832ec1cd507 that required fixups 2a415358ee, and
ef3c4ed3d.

PR-URL: https://github.com/joyent/node/pull/8531
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
dns: propagate domain for c-ares methods

Fixes: https://github.com/joyent/node/issues/5471
PR-URL: https://github.com/joyent/node/pull/8732
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
doc: fix typos in http.markdown

PR-URL: https://github.com/joyent/node/pull/4784
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
doc: clarify return value of http.createServer

PR-URL: https://github.com/joyent/node/pull/6054
Reviewed-by: Isaac Z. Schlueter <i@izs.me>
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
doc: correct broken link in net.markdown

Fixes broken link to Readable Stream documentation.

Fixes: https://github.com/joyent/node/issues/8464
PR-URL: https://github.com/joyent/node/pull/8756
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
path: allow calling platform specific methods

Add path.posix and path.win32 which have the specific methods like
resolve and normalize so you can specifically normalize or resolve
based on the target platform.

PR-URL: https://github.com/joyent/node/pull/5661
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
path: added parse() and format() functions

The parse() function splits a path and returns an object
with the different elements. The format() function is the
reverse of this and adds an objects corresponding path
elements to make up a string. Fixes #6976.

Fixes: https://github.com/joyent/node/issues/6976
PR-URL: https://github.com/joyent/node/pull/8750
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
src: remove async listener

Async listener will have minor reimplementation in a future commit in
the form of hooks for user implemented API. Though for simplicity of
testing it's being completely removed first.
async-wrap: move MakeCallback to .cc

MakeCallback is too large a function to have as an inline. Correct that
by moving it to a .cc file.
node, async-wrap: remove MakeDomainCallback

A lot of code duplication for the removal of a single if statement is
not worth the added code complexity.

Also fixed using v8::Value::As<T>() before verifying the type of the
Value. Casting to an incorrect type will cause V8 to abort in debug
mode.
node: fix throws before timer module is loaded

An edge case could occur when the setImmediate() in _fatalException()
would fire before the timers module had been loaded globally and cause
Node to crash.
src: all wrap's now use actual FunctionTemplate

Instead of just creating a new Object to contain the connection
information, instantiate a new instance of a FunctionTemplate. This will
allow future improvements for debugging and performance probes.

Additionally class providers have been clarified such that the
"provider" field in req_wrap.h is no longer optional.
src: remove unnecessary template parameter
async-wrap: expose async-wrap as binding

Expose basic hooks for AsyncWrap via the async_wrap binding. Right now
only the PROVIDER types are exposed. This is a preliminary step before
more functionality is added.
async-wrap: explicitly pass parent

When instantiating a new AsyncWrap allow the parent AsyncWrap to be
passed. This is useful for cases like TCP incoming connections, so the
connection can be tied to the server receiving the connection.

Because the current architecture instantiates the *Wrap inside a
v8::FunctionCallback, the parent pointer is currently wrapped inside a
new v8::External every time and passed as an argument. A future
optimization would be to add the v8::External as the data field when
creating the v8::FunctionTemplate, change the pointer just before making
the call then NULL'ing it out afterwards. Though this will only knock
off an estimated 80ns, and the added code complexity is high. So not
worth doing until the current approach is proven to be a bottleneck.
async-wrap: add event hooks

Call a user-defined callback at specific points in the lifetime of an
asynchronous event. Which are on instantiation, just before/after the
callback has been run. If the error callback also throws an exception
there will be no mercy and the application will be forced to shutdown.

Currently these only tie into AsyncWrap, meaning no call to a hook
callback will be made for timers or process.nextTick() events. Though
those will be added in a future commit.

Here are a few notes on how to make the hooks work:

- The "this" of all event hook callbacks is the request object.
- The zero field (kCallInitHook) of the flags object passed to
  setupHooks() must be set != 0 before the init callback will be called.
- In the "init" callback the property "_asyncQueue" must be attached to
  the request object. e.g.

  function initHook() {
    this._asyncQueue = {};
  }

- DO NOT inspect the properties of the object in the init callback.
  Since the object is in the middle of being instantiated there are some
  cases when a getter is not complete, and doing so will cause Node to
  crash.