提交 22e1e729 编写于 作者: B Blue Swirl

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
...@@ -128,6 +128,7 @@ common-obj-y += $(addprefix audio/, $(audio-obj-y)) ...@@ -128,6 +128,7 @@ common-obj-y += $(addprefix audio/, $(audio-obj-y))
ui-obj-y += keymaps.o ui-obj-y += keymaps.o
ui-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.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 ui-obj-$(CONFIG_CURSES) += curses.o
vnc-obj-y += vnc.o d3des.o vnc-obj-y += vnc.o d3des.o
vnc-obj-y += vnc-enc-zlib.o vnc-enc-hextile.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 ...@@ -135,7 +136,6 @@ vnc-obj-y += vnc-enc-tight.o vnc-palette.o
vnc-obj-y += vnc-enc-zrle.o vnc-obj-y += vnc-enc-zrle.o
vnc-obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.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_VNC_SASL) += vnc-auth-sasl.o
vnc-obj-$(CONFIG_COCOA) += cocoa.o
ifdef CONFIG_VNC_THREAD ifdef CONFIG_VNC_THREAD
vnc-obj-y += vnc-jobs-async.o vnc-obj-y += vnc-jobs-async.o
else else
......
...@@ -56,7 +56,7 @@ typedef struct coreaudioVoiceOut { ...@@ -56,7 +56,7 @@ typedef struct coreaudioVoiceOut {
static void coreaudio_logstatus (OSStatus status) static void coreaudio_logstatus (OSStatus status)
{ {
char *str = "BUG"; const char *str = "BUG";
switch(status) { switch(status) {
case kAudioHardwareNoError: case kAudioHardwareNoError:
......
...@@ -2473,7 +2473,13 @@ fi ...@@ -2473,7 +2473,13 @@ fi
fdatasync=no fdatasync=no
cat > $TMPC << EOF cat > $TMPC << EOF
#include <unistd.h> #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 EOF
if compile_prog "" "" ; then if compile_prog "" "" ; then
fdatasync=yes fdatasync=yes
......
...@@ -19,13 +19,9 @@ ...@@ -19,13 +19,9 @@
#ifndef _LIBFDT_ENV_H #ifndef _LIBFDT_ENV_H
#define _LIBFDT_ENV_H #define _LIBFDT_ENV_H
#include <stddef.h> #include "bswap.h"
#include <stdint.h>
#include <string.h>
#include <endian.h>
#include <byteswap.h>
#if __BYTE_ORDER == __BIG_ENDIAN #ifdef HOST_WORDS_BIGENDIAN
#define fdt32_to_cpu(x) (x) #define fdt32_to_cpu(x) (x)
#define cpu_to_fdt32(x) (x) #define cpu_to_fdt32(x) (x)
#define fdt64_to_cpu(x) (x) #define fdt64_to_cpu(x) (x)
......
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
# define QEMU_GNUC_PREREQ(maj, min) 0 # define QEMU_GNUC_PREREQ(maj, min) 0
#endif #endif
int qemu_daemon(int nochdir, int noclose);
void *qemu_memalign(size_t alignment, size_t size); void *qemu_memalign(size_t alignment, size_t size);
void *qemu_vmalloc(size_t size); void *qemu_vmalloc(size_t size);
void qemu_vfree(void *ptr); void qemu_vfree(void *ptr);
......
...@@ -26,11 +26,27 @@ ...@@ -26,11 +26,27 @@
* THE SOFTWARE. * 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 "config-host.h"
#include "sysemu.h" #include "sysemu.h"
#include "trace.h" #include "trace.h"
#include "qemu_socket.h" #include "qemu_socket.h"
int qemu_daemon(int nochdir, int noclose)
{
return daemon(nochdir, noclose);
}
void *qemu_oom_check(void *ptr) void *qemu_oom_check(void *ptr)
{ {
if (ptr == NULL) { if (ptr == NULL) {
......
...@@ -132,6 +132,11 @@ static inline char *realpath(const char *path, char *resolved_path) ...@@ -132,6 +132,11 @@ static inline char *realpath(const char *path, char *resolved_path)
#endif /* !defined(NEED_CPU_H) */ #endif /* !defined(NEED_CPU_H) */
/* main function, renamed */
#if defined(CONFIG_COCOA)
int qemu_main(int argc, char **argv, char **envp);
#endif
/* bottom halves */ /* bottom halves */
typedef void QEMUBHFunc(void *opaque); typedef void QEMUBHFunc(void *opaque);
......
...@@ -359,7 +359,7 @@ int main(int argc, char **argv) ...@@ -359,7 +359,7 @@ int main(int argc, char **argv)
if (!verbose) { if (!verbose) {
/* detach client and server */ /* detach client and server */
if (daemon(0, 0) == -1) { if (qemu_daemon(0, 0) == -1) {
err(EXIT_FAILURE, "Failed to daemonize"); err(EXIT_FAILURE, "Failed to daemonize");
} }
} }
......
...@@ -1132,7 +1132,7 @@ static void gen_intermediate_code_internal(CPUState *env, ...@@ -1132,7 +1132,7 @@ static void gen_intermediate_code_internal(CPUState *env,
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
qemu_log("\n"); qemu_log("\n");
log_target_disas(pc_start, dc->pc - pc_start, 0); 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); dc->pc - pc_start, gen_opc_ptr - gen_opc_buf);
} }
#endif #endif
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*/ */
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include <crt_externs.h>
#include "qemu-common.h" #include "qemu-common.h"
#include "console.h" #include "console.h"
...@@ -61,9 +62,7 @@ typedef struct { ...@@ -61,9 +62,7 @@ typedef struct {
int bitsPerPixel; int bitsPerPixel;
} QEMUScreen; } QEMUScreen;
int qemu_main(int argc, char **argv); // main defined in qemu/vl.c
NSWindow *normalWindow; NSWindow *normalWindow;
id cocoaView;
static DisplayChangeListener *dcl; static DisplayChangeListener *dcl;
int gArgc; int gArgc;
...@@ -278,6 +277,8 @@ static int cocoa_keycode_to_qemu(int keycode) ...@@ -278,6 +277,8 @@ static int cocoa_keycode_to_qemu(int keycode)
- (QEMUScreen) gscreen; - (QEMUScreen) gscreen;
@end @end
QemuCocoaView *cocoaView;
@implementation QemuCocoaView @implementation QemuCocoaView
- (id)initWithFrame:(NSRect)frameRect - (id)initWithFrame:(NSRect)frameRect
{ {
...@@ -794,7 +795,7 @@ static int cocoa_keycode_to_qemu(int keycode) ...@@ -794,7 +795,7 @@ static int cocoa_keycode_to_qemu(int keycode)
COCOA_DEBUG("QemuCocoaAppController: startEmulationWithArgc\n"); COCOA_DEBUG("QemuCocoaAppController: startEmulationWithArgc\n");
int status; int status;
status = qemu_main(argc, argv); status = qemu_main(argc, argv, *_NSGetEnviron());
exit(status); exit(status);
} }
...@@ -865,10 +866,20 @@ int main (int argc, const char * argv[]) { ...@@ -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 */ /* In case we don't need to display a window, let's not do that */
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-vnc") || const char *opt = argv[i];
!strcmp(argv[i], "-nographic") ||
!strcmp(argv[i], "-curses")) { if (opt[0] == '-') {
return qemu_main(gArgc, gArgv); /* 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());
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册