Darwin patch (initial patch by Pierre d'Herbemont)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@980 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/vl.c b/vl.c
index 5f1322e..eebc6e6 100644
--- a/vl.c
+++ b/vl.c
@@ -40,7 +40,9 @@
#include <sys/socket.h>
#ifdef _BSD
#include <sys/stat.h>
+#ifndef __APPLE__
#include <libutil.h>
+#endif
#else
#include <linux/if.h>
#include <linux/if_tun.h>
@@ -63,6 +65,7 @@
#endif
#ifdef CONFIG_SDL
+#include <SDL/SDL.h>
#if defined(__linux__)
/* SDL use the pthreads and they modify sigaction. We don't
want that. */
@@ -909,6 +912,7 @@
the emulated kernel requested a too high timer frequency */
getitimer(ITIMER_REAL, &itv);
+#if defined(__linux__)
if (itv.it_interval.tv_usec > 1000) {
/* try to use /dev/rtc to have a faster timer */
if (start_rtc_timer() < 0)
@@ -924,7 +928,9 @@
sigaction(SIGIO, &act, NULL);
fcntl(rtc_fd, F_SETFL, O_ASYNC);
fcntl(rtc_fd, F_SETOWN, getpid());
- } else {
+ } else
+#endif /* defined(__linux__) */
+ {
use_itimer:
pit_min_timer_count = ((uint64_t)itv.it_interval.tv_usec *
PIT_FREQ) / 1000000;
@@ -2622,8 +2628,8 @@
#ifdef CONFIG_SOFTMMU
#ifdef _BSD
- /* mallocs are always aligned on BSD. */
- phys_ram_base = malloc(phys_ram_size);
+ /* mallocs are always aligned on BSD. valloc is better for correctness */
+ phys_ram_base = valloc(phys_ram_size);
#else
phys_ram_base = memalign(TARGET_PAGE_SIZE, phys_ram_size);
#endif