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@citrix.com>
xen-unstable changeset: 17427:
5b25d3264f7e3ca1d9e958be8a8543fcf1fc5958
xen-unstable date: Wed Apr 09 17:49:25 2008 +0100
#include <unistd.h>
#include <zlib.h>
#include <strings.h>
+#include <stdlib.h>
+#include <malloc.h>
#include "xg_private.h"
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
+}
+
/*
* Local variables:
* mode: C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <malloc.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
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 */