[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxc: Move xg_memalign() into a proper source file, so that it
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1207759765 -3600 # Node ID 5b25d3264f7e3ca1d9e958be8a8543fcf1fc5958 # Parent b3fdc4c3899516c981e66c1705dbfd4025bd8cd0 libxc: Move xg_memalign() into a proper source file, so that it definitely does not leak out of tools/libxc. Return to the ioemu/osdep.c way of checking for posix_memalign() as this works on Solaris. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- tools/libxc/xg_private.c | 18 ++++++++++++++++++ tools/libxc/xg_private.h | 18 +----------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff -r b3fdc4c38995 -r 5b25d3264f7e tools/libxc/xg_private.c --- a/tools/libxc/xg_private.c Wed Apr 09 16:54:44 2008 +0100 +++ b/tools/libxc/xg_private.c Wed Apr 09 17:49:25 2008 +0100 @@ -8,6 +8,8 @@ #include <unistd.h> #include <zlib.h> #include <strings.h> +#include <stdlib.h> +#include <malloc.h> #include "xg_private.h" @@ -196,6 +198,22 @@ __attribute__((weak)) { errno = ENOSYS; return -1; +} + +void *xg_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(_BSD) + return valloc(size); +#else + return memalign(alignment, size); +#endif } /* diff -r b3fdc4c38995 -r 5b25d3264f7e tools/libxc/xg_private.h --- a/tools/libxc/xg_private.h Wed Apr 09 16:54:44 2008 +0100 +++ b/tools/libxc/xg_private.h Wed Apr 09 17:49:25 2008 +0100 @@ -7,7 +7,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <malloc.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> @@ -177,21 +176,6 @@ int pin_table(int xc_handle, unsigned in int pin_table(int xc_handle, unsigned int type, unsigned long mfn, domid_t dom); -/* Grrr portability */ -static inline void *xg_memalign(size_t alignment, size_t size) -{ -#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 - int ret; - void *ptr; - ret = posix_memalign(&ptr, alignment, size); - if (ret != 0) - return NULL; - return ptr; -#elif defined(_BSD) - return valloc(size); -#else - return memalign(alignment, size); -#endif -} +void *xg_memalign(size_t alignment, size_t size); #endif /* XG_PRIVATE_H */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |