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-3.2-testing] libxc: Move xg_memalign() into a prope

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.2-testing] libxc: Move xg_memalign() into a proper source file, so that it
From: "Xen patchbot-3.2-testing" <patchbot-3.2-testing@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 09 Apr 2008 10:01:12 -0700
Delivery-date: Wed, 09 Apr 2008 10:01:07 -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 1207759815 -3600
# Node ID 7210da7775348f02b7af747ef61d7b48e25c86a0
# Parent  67b6f1afd3bd282cb7e9edd2e3f9c76b0a402669
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>
xen-unstable changeset:   17427:5b25d3264f7e3ca1d9e958be8a8543fcf1fc5958
xen-unstable date:        Wed Apr 09 17:49:25 2008 +0100
---
 tools/libxc/xg_private.c |   18 ++++++++++++++++++
 tools/libxc/xg_private.h |   18 +-----------------
 2 files changed, 19 insertions(+), 17 deletions(-)

diff -r 67b6f1afd3bd -r 7210da777534 tools/libxc/xg_private.c
--- a/tools/libxc/xg_private.c  Wed Apr 09 17:05:39 2008 +0100
+++ b/tools/libxc/xg_private.c  Wed Apr 09 17:50:15 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 67b6f1afd3bd -r 7210da777534 tools/libxc/xg_private.h
--- a/tools/libxc/xg_private.h  Wed Apr 09 17:05:39 2008 +0100
+++ b/tools/libxc/xg_private.h  Wed Apr 09 17:50:15 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-3.2-testing] libxc: Move xg_memalign() into a proper source file, so that it, Xen patchbot-3.2-testing <=