autogen.sh: use glibtoolize when available

libtoolize is called glibtoolize on osx.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
assert: use feature test for static_cast

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
assert: choose function-var name on non-gnu

Selects __PRETTY_FUNCTION__ or __func__. Linux assumes GNU, and chooses
__PRETTY_FUNCTION__ if gcc/g++ versions are favorable.

This also includes a fix in ax_c_var_func.m4:

AC_TRY_COMPILE will wrap the test in main{}, and then GCC will complain
about nested functions. Just use the original main{} body.

diff --git a/m4/ax_c_var_func.m4 b/m4/ax_c_var_func.m4
index 0ad7d2b..8b57563 100644
--- a/m4/ax_c_var_func.m4
+++ b/m4/ax_c_var_func.m4
@@ -57,9 +57,9 @@ AC_DEFUN([AX_C_VAR_FUNC],
 [AC_REQUIRE([AC_PROG_CC])
 AC_CACHE_CHECK(whether $CC recognizes __func__, ac_cv_c_var_func,
 AC_TRY_COMPILE(,
-[int main() {
+[
 char *s = __func__;
-}],
+],
 AC_DEFINE(HAVE_FUNC,,
 [Define if the C complier supports __func__]) ac_cv_c_var_func=yes,
 ac_cv_c_var_func=no) )

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
client: use struct stat member tests for time

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
pipe: avoid conflict with Pipe.cc on case-insensitive fs

pipe.c and Pipe.cc produce the same intermediate file names on
case-insensitive file systems (like HFS). This renames pipe.c/pipe.h in
order to avoid the conflict.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
autoconf: search for uuid_parse in system libs

AC_SEARCH_LIBS will first try to resolve uuid_parse in the system
libraries (OSX), and then will try other libraries (e.g. libuuid). The
$LIBS variable will be updated with the result, so we don't need an
explicit -luuid in src/Makefile.am.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
code_env: use feature test for PR_GET_NAME support

Function `get_process_name` has platform specific dependencies. Check
for Linux prctl function and correct command flag.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
doc: add dev doc to collect porting notes

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
blkdev: support blkdev size query on osx

Support OSX, add checks for platform specific headers.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
utime: use to_timespec for conversion

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
wbthrottle: use posix_fadvise if available

Only adding information about data usage. This won't effect correctness;
finding analagous techniques on other platforms woudld be useful for
performance.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
context: handle platform without sem_timedwait

On OSX sem_timedwait is not available. This patch simply turns off the
heartbeat interval feature. Building a replacement should be possible, but is
needs some careful thought because pthread mutex/conds aren't thread safe, and
sem_post is called from SIGHUP.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
mon: check for platform specific headers

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
doc: add osx build documentation

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
pipe: use feature tests for pipe2 and O_CLOEXEC

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
xattr: test for xattr routine variants

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
xattr: format code, remove unused intialization

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
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>
fuse: use pkg-config to check for libfuse

Provides better portability. Currently works on all the gitbuilder
platforms, as well as OSX with fuse4x installed.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
fuse: support get/set xattr on OSX

On OSX, the fuse get/set xattr interfaces takes a positional argument
that specifies an offset within the xattr. According to the OSX docs
only the 'resource fork' extended attribute will make use of this
feature and that all other attributes should set this to zero. Ceph
doesn't currently support xattr offsets (at the API level at least).
Therefore Ceph will return ENOTSUP if a non-zero positional argument is
used.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>