MB-9511: Replace use of threadlocal

The old code used a threadlocal storage to stash
away the last errno reported by the operating system.

This patch replace that implementation with one that
pass the the area to store it into the functions.

The motivation for this change is to remove the
the dependency for pthread thread local in the code
for such simple usage of threadlocal..

Change-Id: I57bc1954d877f5fd52481bf7ab1da63e5d901f3e
Reviewed-on: http://review.couchbase.org/30255
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>