spinlock: add generic spinlock implementation

Adds a ceph_spinlock_t implementation that will use pthread_spinlock_t
if available, and otherwise reverts to pthread_mutex_t. Note that this
spinlock is not intended to be used in process-shared memory.

Switches implementation in:

  ceph_context
  SimpleMessenger
  atomic_t

Only ceph_context initialized its spinlock with PTHREAD_PROCESS_SHARED.
However, there does not appear to be any instance in which CephContext
is allocated in shared memory, and thus can use the default private
memory space behavior.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
kvstore: only build on linux

There are several non-standard errno values used. There is still work to
do on addressing errno portability in Ceph, and this disables kvstore on
non-Linux platforms until that work is complete.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
c++11: fix std::lock naming conflicts

Unfortunately, 'using namespace std;' is in pretty widespread use in the Ceph
tree, so we need to rename to avoid the conflict.

Example error output:

test/streamtest.cc:37:19: error: reference to 'lock' is ambiguous
  Mutex::Locker l(lock);
                  ^
test/streamtest.cc:32:7: note: candidate found by name lookup is 'lock'
Mutex lock("streamtest.cc lock");
      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/mutex:346:1: note: candidate found by name lookup is 'std::__1::lock'
lock(_L0& __l0, _L1& __l1)

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
warning: fix typo and -Wmismatched-tags

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
make: use c++ flags for building librados

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
gtest: disable tr1/tuple

Not all compilers are supporting tr1/tuple. This forces libgtest to use
an internal implementation of tuple. Alternatively, the newer 1.6
version of gtest may correctly handle this case automatically.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
test: fix VLA of non-POD type

Variable length array of non-POD type is not supported by clang.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
test: only build some tests on linux

These tests have portability problems that have yet to be solved on
non-Linux systems.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
test: print warning about missing fs features

- sync
- posix_fadvise

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
test: remove platform specific header

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
test: include headers for struct statfs

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
inttypes: use portable types in public headers

loff_t -> int64_t
  __u8 -> uint8_t

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
rados: include struct timeval definition

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Fix test/filestore/store_test.cc error

Commit
https://github.com/ceph/ceph/commit/d2b661d0efe79f5ec96e64647350cee0b80dc887
change the test result, just change it.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Fix qa/workunits/rados/test_cache_pool.sh typos

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Merge pull request #1013 from ceph/port/public-hdrs

use portable types in public headers

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1015 from yuyuyu101/wip-fix-tests

Fix some test codes problems

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1014 from ceph/port/misc

misc portability patches

Reviewed-by: Sage Weil <sage@inktank.com>
Merge pull request #1008 from ceph/port/spinlock

spinlock: add generic spinlock implementation

Reviewed-by: Sage Weil <sage@inktank.com>
common: evaluate --show-config* after CEPH_ARGS

The content of CEPH_ARGS is appended to the list of arguments. When
--show-config or --show-config-value is also set, it should be evaluated
after all arguments are parsed to accurately reflect the value that
would be visible to the program.

It failed to do so because the action for --show-config* was carried out
immediately. It is postponed until all options are parsed instead.

Signed-off-by: Loic Dachary <loic@dachary.org>