[libdispatch-dev] Solaris portability, POSIX memalign() missing - PATCH [2/6]
Joakim Johansson
jocke at tbricks.com
Fri Nov 6 07:01:13 PST 2009
Use memalign() instead...
Joakim
> svn diff malloc_zone.h
Index: malloc_zone.h
===================================================================
--- malloc_zone.h (revision 140)
+++ malloc_zone.h (working copy)
@@ -80,14 +80,28 @@
return (realloc(ptr, size));
}
+/* posix_memalign is not supported with the current shipping release
of Solaris 10, it is
+ fixed in the latest available Solaris Nevada (next-gen) distribution
though, see:
+
+ http://bugs.opensolaris.org/bugdatabase/view_bug.do;jsessionid=3af20a8d00f370311f352b91d5cd?bug_id=6669307
+
+ Falling back at using memalign() here as is done by Sun in the
implementation at:
+ http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/posix_memalign.c
+ */
+
static inline void *
malloc_zone_memalign(malloc_zone_t *zone, size_t alignment, size_t
size)
{
+#ifdef HAS_POSIX_MEMALIGN
void *ptr;
if (posix_memalign(&ptr, alignment, size) < 0)
return (NULL);
+
return (ptr);
+#else
+ return memalign(alignment, size);
+#endif
}
static inline void
octo.tbricks.com:trunk/src/shims>
More information about the libdispatch-dev
mailing list