aboutsummaryrefslogtreecommitdiff
path: root/include/glib-compat.h
AgeCommit message (Collapse)Author
2015-10-30glib: add compatibility interface for g_hash_table_add()Markus Armbruster
The next commit will use it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2015-10-19glib-compat: add 2.38/2.40/2.46 assertsMarc-André Lureau
Those are mostly useful for writing tests. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-05-22glib: remove stale compat functionsJohn Snow
Since we're bumping the version to 2.22+, remove the now-stale compat functions. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1431469140-22208-2-git-send-email-jsnow@redhat.com
2015-05-08glib-compat.h: change assert to g_assertMichael Tokarev
include/glib-compat.h defines a bunch of functions based on glib primitives, and uses assert() without including assert.h. Replace assert() with g_assert() to make the file more self-contained, and to fix compilation breakage after 28507a415a9b1e. Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
2015-04-02glib-compat: fix problems with not-quite glib 2.22Cornelia Huck
Commit 89b516d8b9444ece8ccabb322a9389587c7a7b83 ("glib: add compatibility interface for g_get_monotonic_time()") aimed at making qemu build with old glib versions. At least SLES11SP3, however, contains a backport of g_get_monotonic_time() while keeping the reported glib version at 2.22. Let's work around this by a strategically placed #define. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Message-id: 1427987865-433-2-git-send-email-cornelia.huck@de.ibm.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-10-16glib: add compatibility interface for g_strcmp0()Gonglei
This patch fixes compilation errors when building against glib < 2.16.0 due to the missing g_strcmp0() function. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Message-id: 1413457177-10132-1-git-send-email-arei.gonglei@huawei.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-10-15glib: add compatibility interface for g_get_monotonic_time()Stefan Hajnoczi
This patch fixes compilation errors when building against glib <2.28.0 due to the missing g_get_monotonic_time() function. The compilation error in tests/libqos/virtio.c was introduced in commit 70556264a89a268efba1d7e8e341adcdd7881eb4 ("libqos: use microseconds instead of iterations for virtio timeout"). Add a simple g_get_monotonic_time() implementation to glib-compat.h based on code from vhost-user-test.c. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> [Igor: add G_TIME_SPAN_SECOND, include glib-compat.h in libqtest.h] Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-10glib-compat.h: add new thread API emulation on top of pre-2.31 APIMichael Tokarev
Thread API changed in glib-2.31 significantly. Before that version, conditionals and mutexes were only allocated dynamically, using _new()/_free() interface. in 2.31 and up, they're allocated statically as regular variables, and old interface is deprecated. (Note: glib docs says the new interface is available since version 2.32, but it was actually introduced in version 2.31). Create the new interface using old primitives, by providing non-opaque definitions of the base types (GCond and GMutex) using GOnces. Replace #ifdeffery around GCond and GMutex in trace/simple.c and coroutine-gthread.c too because it does not work anymore with the new glib-compat.h. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> [Use GOnce to support lazy initialization; introduce CompatGMutex and CompatGCond. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-05-09glib: fix g_poll early timeout on windowsSangho Park
g_poll has a problem on Windows when using timeouts < 10ms, in glib/gpoll.c: /* If not, and we have a significant timeout, poll again with * timeout then. Note that this will return indication for only * one event, or only for messages. We ignore timeouts less than * ten milliseconds as they are mostly pointless on Windows, the * MsgWaitForMultipleObjectsEx() call will timeout right away * anyway. */ if (retval == 0 && (timeout == INFINITE || timeout >= 10)) retval = poll_rest (poll_msgs, handles, nhandles, fds, nfds, timeout); so whenever g_poll is called with timeout < 10ms it does a quick poll instead of wait, this causes significant performance degradation of QEMU, thus we should use WaitForMultipleObjectsEx directly Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-07glib: move g_poll() replacement into glib-compat.hStefan Hajnoczi
We have a dedicated header file for wrappers to smooth over glib version differences. Move the g_poll() definition into glib-compat.h for consistency. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Cc: qemu-trivial@nongnu.org
2013-03-25glib: add a compatibility interface for g_timeout_add_secondsAnthony Liguori
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>