diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2011-06-15 18:31:56 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-06-15 18:31:56 +0000 |
commit | 22e1e729600dad1639329185614d094243409359 (patch) | |
tree | addcd6c187e2aed6deec88d20b0df99ca3559eec | |
parent | c235d7387c850857ec6b0ba8ee28c7e1548f68c0 (diff) | |
parent | f97742d0d36810ea72a2bd40b3abb890589ea3b8 (diff) |
Merge branch 'cocoa-for-upstream' of git://repo.or.cz/qemu/afaerber
* 'cocoa-for-upstream' of git://repo.or.cz/qemu/afaerber:
Darwin: Fix compilation warning regarding the deprecated daemon() function
cocoa: Avoid warning related to multiple handleEvent: definitions
cocoa: Revert dependency on VNC
cocoa: Provide central qemu_main() prototype
Fix libfdt warnings on Darwin
configure: Fix check for fdatasync()
Remove warning in printf due to type mismatch
Cocoa: avoid displaying window when command-line contains '-h' or '-help'
Fix compilation warning due to incorrectly specified type
cocoa: do not create a spurious window for -version
-rw-r--r-- | Makefile.objs | 2 | ||||
-rw-r--r-- | audio/coreaudio.c | 2 | ||||
-rwxr-xr-x | configure | 8 | ||||
-rw-r--r-- | libfdt_env.h | 8 | ||||
-rw-r--r-- | osdep.h | 1 | ||||
-rw-r--r-- | oslib-posix.c | 16 | ||||
-rw-r--r-- | qemu-common.h | 5 | ||||
-rw-r--r-- | qemu-nbd.c | 2 | ||||
-rw-r--r-- | target-lm32/translate.c | 2 | ||||
-rw-r--r-- | ui/cocoa.m | 25 |
10 files changed, 53 insertions, 18 deletions
diff --git a/Makefile.objs b/Makefile.objs index f617ed5b7e..cea15e4a82 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -128,6 +128,7 @@ common-obj-y += $(addprefix audio/, $(audio-obj-y)) ui-obj-y += keymaps.o ui-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o +ui-obj-$(CONFIG_COCOA) += cocoa.o ui-obj-$(CONFIG_CURSES) += curses.o vnc-obj-y += vnc.o d3des.o vnc-obj-y += vnc-enc-zlib.o vnc-enc-hextile.o @@ -135,7 +136,6 @@ vnc-obj-y += vnc-enc-tight.o vnc-palette.o vnc-obj-y += vnc-enc-zrle.o vnc-obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o -vnc-obj-$(CONFIG_COCOA) += cocoa.o ifdef CONFIG_VNC_THREAD vnc-obj-y += vnc-jobs-async.o else diff --git a/audio/coreaudio.c b/audio/coreaudio.c index 0a26413d75..3bd75cdda4 100644 --- a/audio/coreaudio.c +++ b/audio/coreaudio.c @@ -56,7 +56,7 @@ typedef struct coreaudioVoiceOut { static void coreaudio_logstatus (OSStatus status) { - char *str = "BUG"; + const char *str = "BUG"; switch(status) { case kAudioHardwareNoError: @@ -2473,7 +2473,13 @@ fi fdatasync=no cat > $TMPC << EOF #include <unistd.h> -int main(void) { return fdatasync(0); } +int main(void) { +#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 +return fdatasync(0); +#else +#abort Not supported +#endif +} EOF if compile_prog "" "" ; then fdatasync=yes diff --git a/libfdt_env.h b/libfdt_env.h index ee0419f7ce..90d7f3b162 100644 --- a/libfdt_env.h +++ b/libfdt_env.h @@ -19,13 +19,9 @@ #ifndef _LIBFDT_ENV_H #define _LIBFDT_ENV_H -#include <stddef.h> -#include <stdint.h> -#include <string.h> -#include <endian.h> -#include <byteswap.h> +#include "bswap.h" -#if __BYTE_ORDER == __BIG_ENDIAN +#ifdef HOST_WORDS_BIGENDIAN #define fdt32_to_cpu(x) (x) #define cpu_to_fdt32(x) (x) #define fdt64_to_cpu(x) (x) @@ -88,6 +88,7 @@ # define QEMU_GNUC_PREREQ(maj, min) 0 #endif +int qemu_daemon(int nochdir, int noclose); void *qemu_memalign(size_t alignment, size_t size); void *qemu_vmalloc(size_t size); void qemu_vfree(void *ptr); diff --git a/oslib-posix.c b/oslib-posix.c index 7bc5f7cf09..3a18e865f3 100644 --- a/oslib-posix.c +++ b/oslib-posix.c @@ -26,11 +26,27 @@ * THE SOFTWARE. */ +/* The following block of code temporarily renames the daemon() function so the + compiler does not see the warning associated with it in stdlib.h on OSX */ +#ifdef __APPLE__ +#define daemon qemu_fake_daemon_function +#include <stdlib.h> +#undef daemon +extern int daemon(int, int); +#endif + #include "config-host.h" #include "sysemu.h" #include "trace.h" #include "qemu_socket.h" + + +int qemu_daemon(int nochdir, int noclose) +{ + return daemon(nochdir, noclose); +} + void *qemu_oom_check(void *ptr) { if (ptr == NULL) { diff --git a/qemu-common.h b/qemu-common.h index 39fabc9e0f..109498dd4d 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -132,6 +132,11 @@ static inline char *realpath(const char *path, char *resolved_path) #endif /* !defined(NEED_CPU_H) */ +/* main function, renamed */ +#if defined(CONFIG_COCOA) +int qemu_main(int argc, char **argv, char **envp); +#endif + /* bottom halves */ typedef void QEMUBHFunc(void *opaque); diff --git a/qemu-nbd.c b/qemu-nbd.c index 110d78e6a4..d91c02ce49 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -359,7 +359,7 @@ int main(int argc, char **argv) if (!verbose) { /* detach client and server */ - if (daemon(0, 0) == -1) { + if (qemu_daemon(0, 0) == -1) { err(EXIT_FAILURE, "Failed to daemonize"); } } diff --git a/target-lm32/translate.c b/target-lm32/translate.c index eb2115814c..5e197258eb 100644 --- a/target-lm32/translate.c +++ b/target-lm32/translate.c @@ -1132,7 +1132,7 @@ static void gen_intermediate_code_internal(CPUState *env, if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("\n"); log_target_disas(pc_start, dc->pc - pc_start, 0); - qemu_log("\nisize=%d osize=%zd\n", + qemu_log("\nisize=%d osize=%td\n", dc->pc - pc_start, gen_opc_ptr - gen_opc_buf); } #endif diff --git a/ui/cocoa.m b/ui/cocoa.m index 20f91bc642..515e684dd2 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -23,6 +23,7 @@ */ #import <Cocoa/Cocoa.h> +#include <crt_externs.h> #include "qemu-common.h" #include "console.h" @@ -61,9 +62,7 @@ typedef struct { int bitsPerPixel; } QEMUScreen; -int qemu_main(int argc, char **argv); // main defined in qemu/vl.c NSWindow *normalWindow; -id cocoaView; static DisplayChangeListener *dcl; int gArgc; @@ -278,6 +277,8 @@ static int cocoa_keycode_to_qemu(int keycode) - (QEMUScreen) gscreen; @end +QemuCocoaView *cocoaView; + @implementation QemuCocoaView - (id)initWithFrame:(NSRect)frameRect { @@ -794,7 +795,7 @@ static int cocoa_keycode_to_qemu(int keycode) COCOA_DEBUG("QemuCocoaAppController: startEmulationWithArgc\n"); int status; - status = qemu_main(argc, argv); + status = qemu_main(argc, argv, *_NSGetEnviron()); exit(status); } @@ -865,10 +866,20 @@ int main (int argc, const char * argv[]) { /* In case we don't need to display a window, let's not do that */ for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-vnc") || - !strcmp(argv[i], "-nographic") || - !strcmp(argv[i], "-curses")) { - return qemu_main(gArgc, gArgv); + const char *opt = argv[i]; + + if (opt[0] == '-') { + /* Treat --foo the same as -foo. */ + if (opt[1] == '-') { + opt++; + } + if (!strcmp(opt, "-h") || !strcmp(opt, "-help") || + !strcmp(opt, "-vnc") || + !strcmp(opt, "-nographic") || + !strcmp(opt, "-version") || + !strcmp(opt, "-curses")) { + return qemu_main(gArgc, gArgv, *_NSGetEnviron()); + } } } |