diff options
author | Alexander Graf <agraf@suse.de> | 2013-02-26 00:46:10 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-02-26 13:35:48 -0600 |
commit | 31e76f65a98e1502cbfd362eed5768c48e264c23 (patch) | |
tree | da347d0b563afdd537fa649ec62a1423724751cc | |
parent | 989b697ddd46769b0999e8cd16b5ecd393204734 (diff) |
glib: Add compat wrapper for g_poll on old glib
Older glib doesn't implement g_poll(). Most notably the glib version in use
on SLE11 is on 2.18 which is hit by this.
We do want to use g_poll() in the source however. So on older systems, just
wrap it with functions that do exist on older versions.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Message-id: 1361835970-2889-1-git-send-email-agraf@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | include/qemu-common.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/qemu-common.h b/include/qemu-common.h index 80016adae3..5e137084b5 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -142,6 +142,18 @@ int qemu_main(int argc, char **argv, char **envp); void qemu_get_timedate(struct tm *tm, int offset); int qemu_timedate_diff(struct tm *tm); +#if !GLIB_CHECK_VERSION(2, 20, 0) +/* + * Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly + * on older systems. + */ +static inline gint g_poll(GPollFD *fds, guint nfds, gint timeout) +{ + GMainContext *ctx = g_main_context_default(); + return g_main_context_get_poll_func(ctx)(fds, nfds, timeout); +} +#endif + /** * is_help_option: * @s: string to test |