diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-11-02 15:43:20 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-11-02 13:07:54 -0500 |
commit | 1f001dc7bc9e435bf231a5b0edcad1c7c2bd6214 (patch) | |
tree | 531f1ce25757189d2ac450a42f8eea75cf50e6fb /qemu-sockets.c | |
parent | 2a0dfd004d9fae4adf2ccfcb2e3b1a76906b48a0 (diff) |
compiler: support Darwin weak references
Weakrefs only tell you if the symbol was defined elsewhere, so you
need a further check at runtime to pick the default definition
when needed.
This could be automated by the compiler, but it does not do it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-sockets.c')
-rw-r--r-- | qemu-sockets.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/qemu-sockets.c b/qemu-sockets.c index f2a637165b..abcd791cb6 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -61,6 +61,28 @@ static QemuOptsList dummy_opts = { }, }; +static int default_monitor_get_fd(Monitor *mon, const char *name, Error **errp) +{ + error_setg(errp, "only QEMU supports file descriptor passing"); + return -1; +} +QEMU_WEAK_ALIAS(monitor_get_fd, default_monitor_get_fd); +#define monitor_get_fd \ + QEMU_WEAK_REF(monitor_get_fd, default_monitor_get_fd) + +static int default_qemu_set_fd_handler2(int fd, + IOCanReadHandler *fd_read_poll, + IOHandler *fd_read, + IOHandler *fd_write, + void *opaque) + +{ + abort(); +} +QEMU_WEAK_ALIAS(qemu_set_fd_handler2, default_qemu_set_fd_handler2); +#define qemu_set_fd_handler2 \ + QEMU_WEAK_REF(qemu_set_fd_handler2, default_qemu_set_fd_handler2) + static int inet_getport(struct addrinfo *e) { struct sockaddr_in *i4; @@ -967,21 +989,3 @@ int socket_init(void) #endif return 0; } - -static int default_monitor_get_fd(Monitor *mon, const char *name, Error **errp) -{ - error_setg(errp, "only QEMU supports file descriptor passing"); - return -1; -} -QEMU_WEAK_ALIAS(monitor_get_fd, default_monitor_get_fd); - -static int default_qemu_set_fd_handler2(int fd, - IOCanReadHandler *fd_read_poll, - IOHandler *fd_read, - IOHandler *fd_write, - void *opaque) - -{ - abort(); -} -QEMU_WEAK_ALIAS(qemu_set_fd_handler2, default_qemu_set_fd_handler2); |