WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxc: Move xg_memalign() into a proper s

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxc: Move xg_memalign() into a proper source file, so that it
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 09 Apr 2008 10:00:18 -0700
Delivery-date: Wed, 09 Apr 2008 10:00:13 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxc: Move xg_memalign() into a proper source file, so that it, Xen patchbot-unstable <=