[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] Re: [PATCH 0 of 2 V5] libxc: checkpoint compression
On Tue, Nov 8, 2011 at 9:20 AM, Shriram Rajagopalan <rshriram@xxxxxxxxx> wrote:
Just realized i forgot to state why I had to the __linux__.
a. minios lacks posix_memalign
b. I looked up online. solaris has no posix_memalign. I am not sure about netbsd.
c. in tools/libxc/
xc_solaris.c uses memalign
xc_netbsd.c uses valloc
xc_minios.c uses memalign
xc_linux_osdep.c uses posix_memalign!
further posix_memalign manpage states that
"posix_memalign() verifies that alignment matches the requirements detailed above.
memalign() may not check that the boundary argument is correct."
fortified by newlib-1.16.0's comments in mallocr.c (newlib-1.16.0/newlib/libc/stdlib/)
"The alignment argument must be a power of two. This property is not
checked by memalign, so misuse may result in random runtime errors."
Judging by all this mess, I thought i was better off doing a #ifdef __linux__ and
resorting to simple malloc for the other platforms.
One alternative would be to add the xc_memalign function alone, that was removed
by c/s 22520.
-void *xc_memalign(size_t alignment, size_t size)
-#if defined(_POSIX_C_SOURCE) && !defined(__sun__)
- int ret;
- void *ptr;
- ret = posix_memalign(&ptr, alignment, size);
- if (ret != 0)
- return NULL;
- return ptr;
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- return valloc(size);
- return memalign(alignment, size);
_______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
Lists.xenproject.org is hosted with RackSpace, monitoring our