compile error on Mac OS X 10.3 (Panther) and the patch

dormando dormando at rydia.net
Mon Nov 12 10:58:54 UTC 2007


js wrote:
> Hi Dormando,
> 
>> Do you (or anyone offhand) know of how to detect OS X before 10.4? It
>> seems wrong to define it for the whole apple platform.
> 
> Maybe like this? (Code from python-2.4.3/Modules/getpath.c)
> 
> #ifdef __APPLE__
> #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
> bla bla bla
> #else
> bla bla bla
> #endif
> 

For the five minutes necessary to verify this, my mac mini has heroically
killed its harddrive. Have my SO's mac now but it doesn't have a compiler
on it and I'm tired.

I think what we want is below, but I probably have some cheesy semantics wrong.

If someone has a MAC with a compiler you can verify this in a cinch:
after:
# define IOV_MAX 1024
add:
#error "DEFINED IOV_MAX!"
... and try to compile. It'll die if you have OS X panther or lower.
If you have OS X tiger or higher, switch the <= to >= and add the #error define
just to be sure it's working.

Extra details, so anyone can jump in and say yay or nay :P I verified build
and test under linux with this patch for shiggles.

Unfortunately, I'm tired and must give up for the night. Weekend was much
more eventful than anticipated. Tomorrow I must procure putty knives.

-Dormando

diff --git a/trunk/server/memcached.c b/trunk/server/memcached.c
index db2a09b..cf85197 100644
--- a/trunk/server/memcached.c
+++ b/trunk/server/memcached.c
@@ -54,7 +54,7 @@ std *
 
 /* FreeBSD 4.x doesn't have IOV_MAX exposed. */
 #ifndef IOV_MAX
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || (MAC_OS_X_VERSION_MAX_ALLOWED <= 1030)
 # define IOV_MAX 1024
 #endif
 #endif


More information about the memcached mailing list