List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:November 30 2007 8:29am
Subject:bk commit into 5.1 tree (stewart:1.2757)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of stewart. When stewart does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-30 19:29:23+11:00, stewart@willster.(none) +3 -0
  fix OSX build (has neither posix_memalign or memalign)

  configure.in@stripped, 2007-11-30 19:29:18+11:00, stewart@willster.(none) +1 -1
    test for memalign as well as posix_memalign.
    Solaris has memalign (so we can implement posix_memalign as a wrapper)
    MacOSX has neither, so we can't.

  storage/ndb/include/portlib/NdbMem.h@stripped, 2007-11-30 19:29:18+11:00, stewart@willster.(none) +15 -0
    implement a ENOTSUP posix_memalign for platforms that have neither posix_memalign or memalign

  storage/ndb/src/common/util/azio.c@stripped, 2007-11-30 19:29:18+11:00, stewart@willster.(none) +6 -2
    fall back to standard malloc() if not possible to do aligned allocations

diff -Nrup a/configure.in b/configure.in
--- a/configure.in	2007-11-29 14:39:45 +11:00
+++ b/configure.in	2007-11-30 19:29:18 +11:00
@@ -1943,7 +1943,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bs
   sighold sigset sigthreadmask port_create sleep \
   snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
   strtol strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
-  posix_fallocate posix_memalign)
+  posix_fallocate posix_memalign memalign)
 
 #
 #
diff -Nrup a/storage/ndb/include/portlib/NdbMem.h b/storage/ndb/include/portlib/NdbMem.h
--- a/storage/ndb/include/portlib/NdbMem.h	2007-11-29 14:39:45 +11:00
+++ b/storage/ndb/include/portlib/NdbMem.h	2007-11-30 19:29:18 +11:00
@@ -74,6 +74,7 @@ int NdbMem_MemLockAll(int);
 int NdbMem_MemUnlockAll(void);
 
 #ifndef HAVE_POSIX_MEMALIGN
+#ifdef HAVE_MEMALIGN /* Solaris 10 has memalign but not posix_memalign */
 static inline int posix_memalign(void **memptr, size_t alignment, size_t size)
 {
   *memptr= memalign(alignment,size);
@@ -81,6 +82,20 @@ static inline int posix_memalign(void **
     return ENOMEM;
   return 0;
 }
+#else /* But Darwin 7.9.0 doesn't have posix_memalign OR memalign */
+static inline int posix_memalign(void **memptr, size_t alignment, size_t size)
+{
+  (void)memptr;
+  (void)alignment;
+  (void)size;
+  return ENOTSUP; /* POSIX says we can return EINVAL or ENOMEM...
+                     but we cheat here and do ENOTSUP so that code
+                     elsewhere can work out if it can fall back to
+                     plain malloc() or not as we cannot reasonably do aligned
+                     memory allocation and free without leaking memory
+                  */
+}
+#endif
 #endif
 
 #ifdef	__cplusplus
diff -Nrup a/storage/ndb/src/common/util/azio.c b/storage/ndb/src/common/util/azio.c
--- a/storage/ndb/src/common/util/azio.c	2007-11-30 18:35:25 +11:00
+++ b/storage/ndb/src/common/util/azio.c	2007-11-30 19:29:18 +11:00
@@ -137,10 +137,14 @@ int az_open (azio_stream *s, const char 
   if(!s->inbuf)
   {
     err= posix_memalign((void**)&(s->inbuf),512,AZ_BUFSIZE_READ);
-    if(err)
+    if(err==ENOTSUP)
+      s->inbuf= malloc(AZ_BUFSIZE_READ);
+    else if(err)
       return -err;
     err= posix_memalign((void**)&(s->outbuf),512,AZ_BUFSIZE_WRITE);
-    if(err)
+    if(err==ENOTSUP)
+      s->inbuf= malloc(AZ_BUFSIZE_READ);
+    else if(err)
       return -err;
     s->bufalloced = 1;
   }
Thread
bk commit into 5.1 tree (stewart:1.2757)Stewart Smith30 Nov