mac: fix for 10.12 having clockid_t
authorJens Axboe <axboe@fb.com>
Fri, 16 Sep 2016 16:05:44 +0000 (10:05 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 16 Sep 2016 16:05:44 +0000 (10:05 -0600)
Previous versions did not have this type, so we defined our own.
As of 10.12 it does seem to, so add a configure test for this.

Signed-off-by: Jens Axboe <axboe@fb.com>
configure
os/os-mac.h

index 2851f54d951a983c2c2467b7188989b0b30eabea..14ec47e9743399707c027db282d612a0daacbc9b 100755 (executable)
--- a/configure
+++ b/configure
@@ -793,6 +793,23 @@ EOF
 fi
 echo "CLOCK_MONOTONIC_PRECISE       $clock_monotonic_precise"
 
 fi
 echo "CLOCK_MONOTONIC_PRECISE       $clock_monotonic_precise"
 
+##########################################
+# clockid_t probe
+clockid_t="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <time.h>
+int main(int argc, char **argv)
+{
+  clockid_t cid = 0;
+  return clock_gettime(cid, NULL);
+}
+EOF
+if compile_prog "" "$LIBS" "clockid_t"; then
+  clockid_t="yes"
+fi
+echo "clockid_t                     $clockid_t"
+
 ##########################################
 # gettimeofday() probe
 gettimeofday="no"
 ##########################################
 # gettimeofday() probe
 gettimeofday="no"
@@ -1722,6 +1739,9 @@ fi
 if test "$clock_monotonic_precise" = "yes" ; then
   output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
 fi
 if test "$clock_monotonic_precise" = "yes" ; then
   output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE"
 fi
+if test "$clockid_t" = "yes"; then
+  output_sym "CONFIG_CLOCKID_T"
+fi
 if test "$gettimeofday" = "yes" ; then
   output_sym "CONFIG_GETTIMEOFDAY"
 fi
 if test "$gettimeofday" = "yes" ; then
   output_sym "CONFIG_GETTIMEOFDAY"
 fi
index 76d388e9201f357b8c6867ca9f8e0e5c799e1602..0903a6fec5c4cd508ff5fefeca69a7e0b9652063 100644 (file)
@@ -35,7 +35,9 @@
 
 typedef off_t off64_t;
 
 
 typedef off_t off64_t;
 
+#ifndef CONFIG_CLOCKID_T
 typedef unsigned int clockid_t;
 typedef unsigned int clockid_t;
+#endif
 
 #define FIO_OS_DIRECTIO
 static inline int fio_set_odirect(int fd)
 
 #define FIO_OS_DIRECTIO
 static inline int fio_set_odirect(int fd)