aboutsummaryrefslogtreecommitdiffstats
path: root/hw/goldfish_memlog.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2010-09-22 14:19:28 +0200
committerDavid 'Digit' Turner <digit@android.com>2010-09-22 14:19:28 +0200
commit4e024bb4f5c8aa8b07459f7fbd65c35122127fd1 (patch)
treeccd5835eef17757d3e1c069e391c415c0135023d /hw/goldfish_memlog.c
parent1d9873b37d2478554d9d678cd410bd3638c8dab3 (diff)
downloadexternal_qemu-4e024bb4f5c8aa8b07459f7fbd65c35122127fd1.zip
external_qemu-4e024bb4f5c8aa8b07459f7fbd65c35122127fd1.tar.gz
external_qemu-4e024bb4f5c8aa8b07459f7fbd65c35122127fd1.tar.bz2
Remove compiler warnings when building the emulator.
This forces -Wall during the build. Note that this patch doesn't remove all warnings, but most of the remaining ones are from upstream anyway. Change-Id: I8808d8495e99866e156ce5780d2e3c305eab491f
Diffstat (limited to 'hw/goldfish_memlog.c')
-rw-r--r--hw/goldfish_memlog.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/hw/goldfish_memlog.c b/hw/goldfish_memlog.c
index f4be28a..6024f38 100644
--- a/hw/goldfish_memlog.c
+++ b/hw/goldfish_memlog.c
@@ -23,8 +23,8 @@ int fd = -1;
static uint32_t memlog_read(void *opaque, target_phys_addr_t offset)
{
- struct goldfish_device *dev = opaque;
-
+ (void)opaque;
+ (void)offset;
return 0;
}
@@ -34,13 +34,19 @@ static void memlog_write(void *opaque, target_phys_addr_t offset, uint32_t val)
{
char buf[128];
struct goldfish_device *dev = opaque;
+ int ret;
+
+ (void)dev;
- info[offset / 4] = val;
+ if (offset < 8*4)
+ info[offset / 4] = val;
if (offset == 0) {
/* write PID and VADDR to logfile */
- sprintf(buf,"%08x %08x\n", info[0], info[1]);
- write(fd, buf, strlen(buf));
+ snprintf(buf, sizeof buf, "%08x %08x\n", info[0], info[1]);
+ do {
+ ret = write(fd, buf, strlen(buf));
+ } while (ret < 0 && errno == EINTR);
}
}
@@ -69,7 +75,9 @@ void goldfish_memlog_init(uint32_t base)
dev->size = 0x1000;
dev->irq_count = 0;
- fd = open("mem.log", /* O_CREAT | */ O_TRUNC | O_WRONLY, 0644);
+ do {
+ fd = open("mem.log", /* O_CREAT | */ O_TRUNC | O_WRONLY, 0644);
+ } while (fd < 0 && errno == EINTR);
goldfish_device_add(dev, memlog_readfn, memlog_writefn, dev);
}