summaryrefslogtreecommitdiffstats
path: root/oslib-posix.c
diff options
context:
space:
mode:
authorJes Sorensen <[email protected]>2010-10-26 10:39:26 +0200
committerBlue Swirl <[email protected]>2010-10-30 08:02:39 +0000
commitb152aa84d52882bb1846485a89baf13aa07c86bc (patch)
treeef36c582e3567543bed0f8d81c5622d2f4e8052a /oslib-posix.c
parentbc4a957c46acd8f4b2f2ffe6b2f90512325924dd (diff)
downloadqemu-kvm-b152aa84d52882bb1846485a89baf13aa07c86bc.tar.gz
qemu-kvm-b152aa84d52882bb1846485a89baf13aa07c86bc.tar.bz2
qemu-kvm-b152aa84d52882bb1846485a89baf13aa07c86bc.zip
Consolidate oom_check() functions
This consolidates the duplicated oom_check() functions, as well as splitting them into OS dependant versions to avoid the #ifdef grossness that was present in the old osdep.c version. Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: Blue Swirl <[email protected]>
Diffstat (limited to 'oslib-posix.c')
-rw-r--r--oslib-posix.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/oslib-posix.c b/oslib-posix.c
index ad44b1763..6e9b0c3c1 100644
--- a/oslib-posix.c
+++ b/oslib-posix.c
@@ -31,8 +31,7 @@
#include "trace.h"
#include "qemu_socket.h"
-#if !defined(_POSIX_C_SOURCE) || defined(__sun__)
-static void *oom_check(void *ptr)
+void *qemu_oom_check(void *ptr)
{
if (ptr == NULL) {
fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno));
@@ -40,7 +39,6 @@ static void *oom_check(void *ptr)
}
return ptr;
}
-#endif
void *qemu_memalign(size_t alignment, size_t size)
{
@@ -54,9 +52,9 @@ void *qemu_memalign(size_t alignment, size_t size)
abort();
}
#elif defined(CONFIG_BSD)
- ptr = oom_check(valloc(size));
+ ptr = qemu_oom_check(valloc(size));
#else
- ptr = oom_check(memalign(alignment, size));
+ ptr = qemu_oom_check(memalign(alignment, size));
#endif
trace_qemu_memalign(alignment, size, ptr);
return ptr;