From c77a77ef0fca8371bba956b78a2da80f73f6f26b Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sat, 9 Aug 2014 23:54:15 -0700 Subject: osx: Enable qemu feature build on Darwin Change-Id: Ie5d437aa6c52c180fd8d54680c5f882e75c0bf7e BUG: 1089172 Signed-off-by: Harshavardhana Reviewed-on: http://review.gluster.org/8448 Tested-by: Gluster Build System Reviewed-by: Kaleb KEITHLEY --- contrib/qemu/include/sysemu/os-posix.h | 2 +- contrib/qemu/util/oslib-posix.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'contrib') diff --git a/contrib/qemu/include/sysemu/os-posix.h b/contrib/qemu/include/sysemu/os-posix.h index ed8cbaff6a3..ac4a80e6d8c 100644 --- a/contrib/qemu/include/sysemu/os-posix.h +++ b/contrib/qemu/include/sysemu/os-posix.h @@ -36,7 +36,7 @@ int os_mlock(void); typedef struct timeval qemu_timeval; #define qemu_gettimeofday(tp) gettimeofday(tp, NULL) -#if !defined(CONFIG_UTIMENSAT) || defined(__FreeBSD__) +#if !defined(CONFIG_UTIMENSAT) || defined(__FreeBSD__) || defined(__APPLE__) #ifndef UTIME_NOW # define UTIME_NOW ((1l << 30) - 1l) #endif diff --git a/contrib/qemu/util/oslib-posix.c b/contrib/qemu/util/oslib-posix.c index 77cb9b72d1d..bac4c1a158e 100644 --- a/contrib/qemu/util/oslib-posix.c +++ b/contrib/qemu/util/oslib-posix.c @@ -86,7 +86,7 @@ void *qemu_oom_check(void *ptr) void *qemu_memalign(size_t alignment, size_t size) { void *ptr; -#if defined(_POSIX_C_SOURCE) && !defined(__sun__) +#if defined(_POSIX_C_SOURCE) && !defined(__sun__) || defined(__APPLE__) int ret; ret = posix_memalign(&ptr, alignment, size); if (ret != 0) { @@ -175,10 +175,12 @@ int qemu_pipe(int pipefd[2]) int ret; #ifdef CONFIG_PIPE2 +#ifdef pipe2 ret = pipe2(pipefd, O_CLOEXEC); if (ret != -1 || errno != ENOSYS) { return ret; } +#endif #endif ret = pipe(pipefd); if (ret == 0) { @@ -194,13 +196,15 @@ int qemu_utimens(const char *path, const struct timespec *times) struct timeval tv[2], tv_now; struct stat st; int i; -#if defined(CONFIG_UTIMENSAT) && !defined(__FreeBSD__) +#if defined(CONFIG_UTIMENSAT) +#ifdef utimensat int ret; ret = utimensat(AT_FDCWD, path, times, AT_SYMLINK_NOFOLLOW); if (ret != -1 || errno != ENOSYS) { return ret; } +#endif #endif /* Fallback: use utimes() instead of utimensat() */ -- cgit