On Fri, Mar 15, 2013 at 4:44 PM, Anthony Liguori <aligu...@us.ibm.com> wrote: > Laurent Desnogues <laurent.desnog...@gmail.com> writes: > >> Hello, >> >> On Tue, Mar 5, 2013 at 6:51 PM, Amit Shah <amit.s...@redhat.com> wrote: >>> From: Anthony Liguori <aligu...@us.ibm.com> >>> >>> Signed-off-by: Anthony Liguori <aligu...@us.ibm.com> >>> Signed-off-by: Amit Shah <amit.s...@redhat.com> >>> --- >>> qemu-char.c | 68 >>> ++++++++++++++++++++++++++++++++++++++++--------------------- >>> 1 file changed, 45 insertions(+), 23 deletions(-) >>> >>> diff --git a/qemu-char.c b/qemu-char.c >>> index eb0ac81..6dba943 100644 >>> --- a/qemu-char.c >>> +++ b/qemu-char.c >>> @@ -990,12 +990,50 @@ typedef struct { >>> int connected; >>> int polling; >>> int read_bytes; >>> - QEMUTimer *timer; >>> + guint timer_tag; >>> } PtyCharDriver; >>> >>> static void pty_chr_update_read_handler(CharDriverState *chr); >>> static void pty_chr_state(CharDriverState *chr, int connected); >>> >>> +static gboolean pty_chr_timer(gpointer opaque) >>> +{ >>> + struct CharDriverState *chr = opaque; >>> + PtyCharDriver *s = chr->opaque; >>> + >>> + if (s->connected) { >>> + goto out; >>> + } >>> + if (s->polling) { >>> + /* If we arrive here without polling being cleared due >>> + * read returning -EIO, then we are (re-)connected */ >>> + pty_chr_state(chr, 1); >>> + goto out; >>> + } >>> + >>> + /* Next poll ... */ >>> + pty_chr_update_read_handler(chr); >>> + >>> +out: >>> + return FALSE; >>> +} >>> + >>> +static void pty_chr_rearm_timer(CharDriverState *chr, int ms) >>> +{ >>> + PtyCharDriver *s = chr->opaque; >>> + >>> + if (s->timer_tag) { >>> + g_source_remove(s->timer_tag); >>> + s->timer_tag = 0; >>> + } >>> + >>> + if (ms == 1000) { >>> + s->timer_tag = g_timeout_add_seconds(1, pty_chr_timer, chr); >> >> It looks like g_timeout_add_seconds isn't available for >> poor people using some old distros (glib 2.12.3 here). > > Can you test adding: > > #if !GLIB_CHECK_VERSION(2, 14, 0) > static guint g_timeout_add_seconds(guint interval, GSourceFunc function, > gpointer data) > { > return g_timeout_add(interval * 1000, function, data); > } > #endif > > We probably should introduce a glib-compat to centralize work arounds > for older versions of glib...
Hi Anthony, Are you sending a patch for g_timeout_add_seconds() compatibility? The RHEL5 builds are failing because their glib is old: http://buildbot.b1-systems.de/qemu/builders/default_x86_64_rhel5/builds/551/steps/compile/logs/stdio Stefan