summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/timer-wheel/timer-wheel.h2
-rw-r--r--libglusterfs/src/locking.h9
-rw-r--r--tools/gfind_missing_files/Makefile.am2
-rw-r--r--tools/gfind_missing_files/gcrawler.c24
-rw-r--r--xlators/features/changelog/lib/src/gf-changelog-helpers.h2
5 files changed, 22 insertions, 17 deletions
diff --git a/contrib/timer-wheel/timer-wheel.h b/contrib/timer-wheel/timer-wheel.h
index faa941a240b..baa029ebb30 100644
--- a/contrib/timer-wheel/timer-wheel.h
+++ b/contrib/timer-wheel/timer-wheel.h
@@ -17,7 +17,7 @@
#ifndef __TIMER_WHEEL_H
#define __TIMER_WHEEL_H
-#include <pthread.h>
+#include "locking.h"
#include "list.h"
diff --git a/libglusterfs/src/locking.h b/libglusterfs/src/locking.h
index a66cdc188db..24edf9aed44 100644
--- a/libglusterfs/src/locking.h
+++ b/libglusterfs/src/locking.h
@@ -12,6 +12,15 @@
#define _LOCKING_H
#include <pthread.h>
+#ifdef GF_DARWIN_HOST_OS
+#include <libkern/OSAtomic.h>
+#define pthread_spinlock_t OSSpinLock
+#define pthread_spin_lock(l) OSSpinLockLock(l)
+#define pthread_spin_unlock(l) OSSpinLockUnlock(l)
+#define pthread_spin_destroy(l) 0
+#define pthread_spin_init(l, v) (*l = v)
+#endif
+
#if HAVE_SPINLOCK
#define LOCK_INIT(x) pthread_spin_init (x, 0)
diff --git a/tools/gfind_missing_files/Makefile.am b/tools/gfind_missing_files/Makefile.am
index 456aad836b6..043c34c4182 100644
--- a/tools/gfind_missing_files/Makefile.am
+++ b/tools/gfind_missing_files/Makefile.am
@@ -9,6 +9,8 @@ EXTRA_DIST = gfind_missing_files.sh gfid_to_path.sh \
gfindmissingfiles_PROGRAMS = gcrawler
gcrawler_SOURCES = gcrawler.c
+gcrawler_LDADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
+gcrawler_LDFLAGS = $(GF_LDFLAGS)
AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src
diff --git a/tools/gfind_missing_files/gcrawler.c b/tools/gfind_missing_files/gcrawler.c
index 517e773cb7c..6be8e48364d 100644
--- a/tools/gfind_missing_files/gcrawler.c
+++ b/tools/gfind_missing_files/gcrawler.c
@@ -12,21 +12,15 @@
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <assert.h>
+#include "locking.h"
-#ifndef __FreeBSD__
-#ifdef __NetBSD__
-#include <sys/xattr.h>
-#else
-#include <attr/xattr.h>
-#endif /* __NetBSD__ */
-#endif /* __FreeBSD__ */
-
+#include "compat.h"
#include "list.h"
+#include "syscall.h"
#define THREAD_MAX 32
#define BUMP(name) INC(name, 1)
@@ -325,7 +319,7 @@ xworker_do_crawl (struct xwork *xwork, struct dirjob *job)
tdbg ("Entering: %s\n", job->dirname);
- dirp = opendir (job->dirname);
+ dirp = sys_opendir (job->dirname);
if (!dirp) {
terr ("opendir failed on %s (%s)\n", job->dirname,
strerror (errno));
@@ -387,7 +381,7 @@ xworker_do_crawl (struct xwork *xwork, struct dirjob *job)
ret = 0;
out:
if (dirp)
- closedir (dirp);
+ sys_closedir (dirp);
return ret;
}
@@ -527,15 +521,15 @@ parse_and_validate_args (int argc, char *argv[])
}
basedir = argv[1];
- ret = lstat (basedir, &d);
+ ret = sys_lstat (basedir, &d);
if (ret) {
err ("%s: %s\n", basedir, strerror (errno));
return NULL;
}
#ifndef __FreeBSD__
- ret = lgetxattr (basedir, "trusted.glusterfs.volume-id",
- volume_id, 16);
+ ret = sys_lgetxattr (basedir, "trusted.glusterfs.volume-id",
+ volume_id, 16);
if (ret != 16) {
err ("%s:Not a valid brick path.\n", basedir);
return NULL;
@@ -543,7 +537,7 @@ parse_and_validate_args (int argc, char *argv[])
#endif /* __FreeBSD__ */
slv_mnt = argv[2];
- ret = lstat (slv_mnt, &d);
+ ret = sys_lstat (slv_mnt, &d);
if (ret) {
err ("%s: %s\n", slv_mnt, strerror (errno));
return NULL;
diff --git a/xlators/features/changelog/lib/src/gf-changelog-helpers.h b/xlators/features/changelog/lib/src/gf-changelog-helpers.h
index adde1e57bbf..bd21e4df035 100644
--- a/xlators/features/changelog/lib/src/gf-changelog-helpers.h
+++ b/xlators/features/changelog/lib/src/gf-changelog-helpers.h
@@ -14,7 +14,7 @@
#include <unistd.h>
#include <dirent.h>
#include <limits.h>
-#include <pthread.h>
+#include "locking.h"
#include <xlator.h>