[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 11/20] qemu-char: use a glib timeout instead of
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 11/20] qemu-char: use a glib timeout instead of qemu-timer |
Date: |
Mon, 25 Mar 2013 10:38:28 +0100 |
On Fri, Mar 15, 2013 at 4:44 PM, Anthony Liguori <address@hidden> wrote:
> Laurent Desnogues <address@hidden> writes:
>
>> Hello,
>>
>> On Tue, Mar 5, 2013 at 6:51 PM, Amit Shah <address@hidden> wrote:
>>> From: Anthony Liguori <address@hidden>
>>>
>>> Signed-off-by: Anthony Liguori <address@hidden>
>>> Signed-off-by: Amit Shah <address@hidden>
>>> ---
>>> 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
- [Qemu-devel] [PATCH 05/20] qemu-char: convert pty to GIOChannel, (continued)
- [Qemu-devel] [PATCH 05/20] qemu-char: convert pty to GIOChannel, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 06/20] qemu-char: convert UDP to GIOChannel, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 07/20] qemu-char: tcp: make use GIOChannel, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 08/20] qemu-char: add watch support, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 09/20] qemu-char: add pty watch, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 10/20] char: add gio watch fn for tcp backends, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 11/20] qemu-char: use a glib timeout instead of qemu-timer, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 12/20] qemu-char: remove use of QEMUTimer in favor of glib idle function, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 13/20] qemu-char: make char drivers dynamically registerable, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 14/20] qemu-char: move spice registration to spice-qemu-char.c, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 15/20] qemu-char: move baum registration to baum.c, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 16/20] qemu-char: move msmouse registeration to msmouse.c, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 17/20] qemu-char: move text console init to console.c, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 18/20] serial: add flow control to transmit, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 19/20] virtio: console: add flow control, Amit Shah, 2013/03/05
- [Qemu-devel] [PATCH 20/20] virtio-serial: make flow control explicit in virtio-console, Amit Shah, 2013/03/05