[master] e5975a5 Fix OS/X compilation for good.

Poul-Henning Kamp phk at varnish-cache.org
Mon Sep 19 20:26:49 CEST 2011


commit e5975a5f721fa91b954735b54121d54554696cba
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 19 18:26:20 2011 +0000

    Fix OS/X compilation for good.
    
    Fixes	#1022

diff --git a/bin/varnishd/cache_pool.c b/bin/varnishd/cache_pool.c
index 811b233..7b79873 100644
--- a/bin/varnishd/cache_pool.c
+++ b/bin/varnishd/cache_pool.c
@@ -59,9 +59,32 @@
 #include "stevedore.h"
 #include "hash_slinger.h"
 
+/*--------------------------------------------------------------------
+ * MAC OS/X is incredibly moronic when it comes to time and such...
+ */
+
 #ifndef CLOCK_MONOTONIC
-#define CLOCK_MONOTONIC CLOCK_REALTIME		/* OS/X is silly */
-#endif
+#define CLOCK_MONOTONIC	0
+
+static int
+clock_gettime(int foo, struct timespec *ts)
+{
+	struct timeval tv;
+
+	gettimeofday(&tv, NULL);
+	ts->tv_sec = tv.tv_sec;
+	ts->tv_nsec = tv.tv_usec * 1000;
+	return (0);
+}
+
+static int
+pthread_condattr_setclock(pthread_condattr_t *attr, int foo)
+{
+	(void)attr;
+	(void)foo;
+	return (0);
+}
+#endif /* !CLOCK_MONOTONIC */
 
 static void *waiter_priv;
 



More information about the varnish-commit mailing list