From: Stefan Weil <weil@mail.berlios.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [Patch] Fix compiler warnings
Date: Mon, 01 Oct 2007 22:24:26 +0200 [thread overview]
Message-ID: <4701577A.8050509@mail.berlios.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
Hello,
this patch fixes some compiler warnings in two QEMU source files:
* missing include unistd.h for syscall
* comparision of unsigned value with -1
(mmap returns pointer with error value MAP_FAILED)
I also replaced leading tabs in mmap.c by blanks.
Please add this patch to CVS head.
Regards
Stefan
[-- Attachment #2: qemu.patch --]
[-- Type: text/x-diff, Size: 3561 bytes --]
Index: linux-user/mmap.c
===================================================================
RCS file: /sources/qemu/qemu/linux-user/mmap.c,v
retrieving revision 1.16
diff -u -b -B -w -u -r1.16 mmap.c
--- linux-user/mmap.c 30 Sep 2007 14:32:45 -0000 1.16
+++ linux-user/mmap.c 1 Oct 2007 20:15:22 -0000
@@ -100,7 +100,7 @@
target_ulong start, target_ulong end,
int prot, int flags, int fd, target_ulong offset)
{
- target_ulong real_end, ret, addr;
+ target_ulong real_end, addr;
void *host_start;
int prot1, prot_new;
@@ -116,10 +116,10 @@
if (prot1 == 0) {
/* no page was there, so we allocate one */
- ret = (long)mmap(host_start, qemu_host_page_size, prot,
+ void *p = mmap(host_start, qemu_host_page_size, prot,
flags | MAP_ANONYMOUS, -1, 0);
- if (ret == -1)
- return ret;
+ if (p == MAP_FAILED)
+ return -1;
prot1 = prot;
}
prot1 &= PAGE_BITS;
@@ -230,16 +230,16 @@
*/
target_ulong host_end;
unsigned long host_aligned_start;
+ void *p;
host_len = HOST_PAGE_ALIGN(host_len + qemu_host_page_size
- qemu_real_host_page_size);
- host_start = (unsigned long) mmap(real_start ?
- g2h(real_start) : NULL,
- host_len, prot, flags,
- fd, host_offset);
- if (host_start == -1)
+ p = mmap(real_start ? g2h(real_start) : NULL,
+ host_len, prot, flags, fd, host_offset);
+ if (p == MAP_FAILED)
return -1;
+ host_start = (unsigned long)p;
host_end = host_start + host_len;
/* Find start and end, aligned to the targets pagesize with-in the
@@ -260,11 +260,12 @@
goto the_end1;
} else {
/* if not fixed, no need to do anything */
- host_start = (long)mmap(real_start ? g2h(real_start) : NULL,
+ void *p = mmap(real_start ? g2h(real_start) : NULL,
host_len, prot, flags, fd, host_offset);
- if (host_start == -1)
+ if (p == MAP_FAILED)
return -1;
/* update start so that it points to the file position at 'offset' */
+ host_start = (unsigned long)p;
if (!(flags & MAP_ANONYMOUS))
host_start += offset - host_offset;
start = h2g(host_start);
@@ -333,14 +334,15 @@
/* map the middle (easier) */
if (real_start < real_end) {
+ void *p;
unsigned long offset1;
if (flags & MAP_ANONYMOUS)
offset1 = 0;
else
offset1 = offset + real_start - start;
- ret = (long)mmap(g2h(real_start), real_end - real_start,
+ p = mmap(g2h(real_start), real_end - real_start,
prot, flags, fd, offset1);
- if (ret == -1)
+ if (p == MAP_FAILED)
return -1;
}
the_end1:
Index: target-i386/helper2.c
===================================================================
RCS file: /sources/qemu/qemu/target-i386/helper2.c,v
retrieving revision 1.52
diff -u -b -B -w -u -r1.52 helper2.c
--- target-i386/helper2.c 23 Sep 2007 15:28:04 -0000 1.52
+++ target-i386/helper2.c 1 Oct 2007 20:15:22 -0000
@@ -32,6 +32,7 @@
//#define DEBUG_MMU
#ifdef USE_CODE_COPY
+#include <unistd.h>
#include <asm/ldt.h>
#include <linux/unistd.h>
#include <linux/version.h>
next reply other threads:[~2007-10-01 20:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-01 20:24 Stefan Weil [this message]
2007-11-01 15:06 ` [Qemu-devel] [Patch] Fix compiler warnings Stefan Weil
-- strict thread matches above, loose matches on Subject: below --
2009-08-31 14:29 [Qemu-devel] [PATCH] " Stefan Weil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4701577A.8050509@mail.berlios.de \
--to=weil@mail.berlios.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).