* [Qemu-devel] [patch] unbreak linux-user builds
@ 2009-01-23 12:10 Gerd Hoffmann
2009-01-23 15:02 ` Anthony Liguori
0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2009-01-23 12:10 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 40 bytes --]
$subject says all
please apply,
Gerd
[-- Attachment #2: 0001-linux-user-add-qemu_realloc-implementation-to-unb.patch --]
[-- Type: text/plain, Size: 1045 bytes --]
>From b0dbc4afae21c0f8fb9c6ec509fd07515307fc6d Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 23 Jan 2009 12:49:00 +0100
Subject: [PATCH 1/3] linux-user: add qemu_realloc() implementation to unbreak the build.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
linux-user/mmap.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 8e81cde..d0fc3e3 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -123,6 +123,19 @@ void qemu_free(void *ptr)
munmap(p, *p);
}
+void *qemu_realloc(void *ptr, size_t size)
+{
+ size_t old_size, copy;
+ void *new_ptr;
+
+ old_size = *(size_t *)((char *)ptr - 16);
+ copy = old_size < size ? old_size : size;
+ new_ptr = qemu_malloc(size);
+ memcpy(new_ptr, ptr, copy);
+ qemu_free(ptr);
+ return new_ptr;
+}
+
/* NOTE: all the constants are the HOST ones, but addresses are target. */
int target_mprotect(abi_ulong start, abi_ulong len, int prot)
{
--
1.6.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [patch] unbreak linux-user builds
2009-01-23 12:10 [Qemu-devel] [patch] unbreak linux-user builds Gerd Hoffmann
@ 2009-01-23 15:02 ` Anthony Liguori
2009-01-23 19:12 ` malc
0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liguori @ 2009-01-23 15:02 UTC (permalink / raw)
To: qemu-devel
Gerd Hoffmann wrote:
> $subject says all
>
> please apply,
> Gerd
>
Applied. Thanks.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [patch] unbreak linux-user builds
2009-01-23 15:02 ` Anthony Liguori
@ 2009-01-23 19:12 ` malc
0 siblings, 0 replies; 3+ messages in thread
From: malc @ 2009-01-23 19:12 UTC (permalink / raw)
To: qemu-devel
On Fri, 23 Jan 2009, Anthony Liguori wrote:
> Gerd Hoffmann wrote:
>> $subject says all
>>
>> please apply,
>> Gerd
>>
> Applied. Thanks.
>
This breaks the contract that qemu_realloc in qemu-malloc.c makes (by
calling system realloc and lacking any documentation), namely that
calling qemu_realloc with NULL ptr is equivavlent to malloc...
--
mailto:av1474@comtv.ru
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-23 19:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-23 12:10 [Qemu-devel] [patch] unbreak linux-user builds Gerd Hoffmann
2009-01-23 15:02 ` Anthony Liguori
2009-01-23 19:12 ` malc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).