ovs-atomic: New library for atomic operations.

This library should prove useful for the threading changes coming up.
The following commit introduces one (very simple) user.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-thread: Add support for convenient once-only initializers.

pthread_once() is portable but it does not allow passing any parameters to
the initialization function, which is often inconvenient, because it means
that the function can only access data declared at file scope.  This commit
introduces an alternative with a more convenient interface.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-thread: Add support for various thread-related assertions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
New function ovs_strerror() as a thread-safe replacement for strerror().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Replace all uses of strerror() by ovs_strerror(), for thread safety.

Signed-off-by: Ben Pfaff <blp@nicira.com>
random: Make thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Use random_*() instead of rand(), for thread safety.

None of these test programs are threaded, but has little cost and means
that "grep" doesn't turn up any instances of these thread-unsafe functions
in our tree.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Makefile: Blacklist functions that threaded programs cannot use safely.

Some functions that POSIX says cannot be used safely in multithreaded
programs are not on the initial blacklist:

    - getenv() should be safe in real implementations in the absence of
      changes to the environment.  (putenv() and setenv() are blacklisted.)

    - We only use getopt() before spawning extra threads, and I expect this
      to continue to be true.

Signed-off-by: Ben Pfaff <blp@nicira.com>