int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,

                          GIOFunc func, void *user_data)

{

    GSource *src;

    guint tag;



    if (s->chr_add_watch == NULL) {

        return -ENOSYS;

    }



    src = s->chr_add_watch(s, cond);

    if (!src) {

        return -EINVAL;

    }



    g_source_set_callback(src, (GSourceFunc)func, user_data, NULL);

    tag = g_source_attach(src, NULL);

    g_source_unref(src);



    return tag;

}

int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,

                          GIOFunc func, void *user_data)

{

    GSource *src;

    guint tag;



    if (s->chr_add_watch == NULL) {

        return -ENOSYS;

    }



    src = s->chr_add_watch(s, cond);

    if (!src) {

        return -EINVAL;

    }



    g_source_set_callback(src, (GSourceFunc)func, user_data, NULL);

    tag = g_source_attach(src, NULL);

    g_source_unref(src);



    return tag;

}

int FUNC_0(CharDriverState *VAR_0, GIOCondition VAR_1,

                          GIOFunc VAR_2, void *VAR_3)

{

    GSource *src;

    guint tag;



    if (VAR_0->chr_add_watch == NULL) {

        return -ENOSYS;

    }



    src = VAR_0->chr_add_watch(VAR_0, VAR_1);

    if (!src) {

        return -EINVAL;

    }



    g_source_set_callback(src, (GSourceFunc)VAR_2, VAR_3, NULL);

    tag = g_source_attach(src, NULL);

    g_source_unref(src);



    return tag;

}

int FUNC_0(CharDriverState *VAR_0, GIOCondition VAR_1,
GIOFunc VAR_2, void *VAR_3)
{ GSource *src; guint tag; if (VAR_0->chr_add_watch == NULL) { return -ENOSYS; } src = VAR_0->chr_add_watch(VAR_0, VAR_1); if (!src) { return -EINVAL; } g_source_set_callback(src, (GSourceFunc)VAR_2, VAR_3, NULL); tag = g_source_attach(src, NULL); g_source_unref(src); return tag; }