qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] block/file-posix.c: Fix compilation on macOS SDKs <10.12.4


From: Evan Miller
Subject: [PATCH] block/file-posix.c: Fix compilation on macOS SDKs <10.12.4
Date: Mon, 29 Nov 2021 09:43:30 -0500

fpunchhole_t was introduced in the macOS 10.12.4 SDK. For reference, see:

https://developer.apple.com/documentation/kernel/fpunchhole_t

Test the SDK version before attempting any fpunchhole_t-related logic.


Signed-off-by: Evan Miller <emmiller@gmail.com>

--- block/file-posix.c.orig
+++ block/file-posix.c
@@ -1830,7 +1830,9 @@
         ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
                            aiocb->aio_offset, aiocb->aio_nbytes);
         ret = translate_err(-errno);
-#elif defined(__APPLE__) && (__MACH__)
+#elif defined(__APPLE__) && (__MACH__) && \
+      defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
+      __MAC_OS_X_VERSION_MAX_ALLOWED >= 101204
         fpunchhole_t fpunchhole;
         fpunchhole.fp_flags = 0;
         fpunchhole.reserved = 0;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]