| Submitter | Alexander Graf |
|---|---|
| Date | Feb. 25, 2013, 11:46 p.m. |
| Message ID | <1361835970-2889-1-git-send-email-agraf@suse.de> |
| Download | mbox | patch |
| Permalink | /patch/223070/ |
| State | New |
| Headers | show |
Comments
On Tue, Feb 26, 2013 at 12:46 AM, Alexander Graf <agraf@suse.de> wrote: > 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. That compiles fine on my old CentOS workstation. Thanks, Laurent > Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> > Signed-off-by: Alexander Graf <agraf@suse.de> > --- > 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 80016ad..5e13708 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 > -- > 1.6.0.2 >
Thanks, Fixes build on my redhat machine. On Tue, Feb 26, 2013 at 9:46 AM, Alexander Graf <agraf@suse.de> wrote: > 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> Tested-by Peter Crosthwaite <peter.crosthwaite@xilinx.com> > --- > 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 80016ad..5e13708 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 > -- > 1.6.0.2 > >
On Tue, Feb 26, 2013 at 12:46:10AM +0100, Alexander Graf wrote: > 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> > --- > include/qemu-common.h | 12 ++++++++++++ > 1 files changed, 12 insertions(+), 0 deletions(-) Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Il 26/02/2013 00:46, Alexander Graf ha scritto: > 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> > --- > 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 80016ad..5e13708 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 That's not g_poll. g_poll is just good old poll(2) on POSIX systems. This is fine, but call it glib_poll and use it unconditionally. Paolo > /** > * is_help_option: > * @s: string to test >
Paolo Bonzini <pbonzini@redhat.com> writes: > Il 26/02/2013 00:46, Alexander Graf ha scritto: >> 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> >> --- >> 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 80016ad..5e13708 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 > > That's not g_poll. Technically it is. The function pointer it returns is just g_poll(). I agree that we should use it unconditionally though because glib let's you change this function. Technically speaking, we should use this mechanism instead of calling g_poll directly. Regards, Anthony Liguori g_poll is just good old poll(2) on POSIX systems. > This is fine, but call it glib_poll and use it unconditionally. > > Paolo > >> /** >> * is_help_option: >> * @s: string to test >>
Applied. Thanks. Regards, Anthony Liguori
Patch
diff --git a/include/qemu-common.h b/include/qemu-common.h index 80016ad..5e13708 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