fix !O_NONBLOCK where ~O_NONBLOCK was meant

Using ! on a non-zero value will always return 0.

Also remove some duplicate and superfluous code in other places.
Print actual Win32 error that occurred on file creation failure.
Checking whether closing succeeds
Allow files to be opened for reading multiple times
Try to increase file descriptor rlimit if necessary

As the default can be too low, especially on OSX.
Merge pull request #2568 from sipa/rlimit

Try to increase file descriptor rlimit if necessary
Merge pull request #2589 from sipa/win32ldberr

Some win32-leveldb related fixes
Merge pull request #2583 from laanwj/2013_04_netbase_bitfield

netbase: fix !O_NONBLOCK where ~O_NONBLOCK was meant
Don't announce to non-peer CNodes
Merge pull request #2595 from sipa/noannloc

Don't announce to non-peer CNodes
RPC: strictly require HTTP URI "/"

Previously, JSON-RPC clients accessed URI "/", and the JSON-RPC server
did not care about the URI at all, and would accept any URI as valid.

Change the JSON-RPC server to require URI "/" for all current accesses.

This changes enables the addition of future interfaces at different
URIs, such as pull request #1982 which demonstrates HTTP REST wallet
download.

Or, a future, breaking change in JSON-RPC interface could be introduced
by serving JSON-RPC calls from new URI "/v2/".
Merge pull request #2601 from jgarzik/uri-validate

RPC: strictly require HTTP URI "/"