Message ID | 1335538928-3978-1-git-send-email-sw@weilnetz.de |
---|---|
State | Accepted |
Headers | show |
On Fri, Apr 27, 2012 at 15:02, Stefan Weil <sw@weilnetz.de> wrote: > This patch fixes a build regression with MinGW which was introduced by > commit 7c7db75576bd5a31508208f153c5aada64b2c8df. > > The 3rd argument of g_main_context_query must point to a gint value. > Using a pointer to an uint32_t value is wrong. > > The timeout argument of function os_host_main_loop_wait was never > used for w32 / w64. > > Signed-off-by: Stefan Weil <sw@weilnetz.de> Thanks, applied. > --- > main-loop.c | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/main-loop.c b/main-loop.c > index 0457bf2..24cf540 100644 > --- a/main-loop.c > +++ b/main-loop.c > @@ -410,6 +410,7 @@ static int os_host_main_loop_wait(uint32_t timeout) > int ret, i; > PollingEntry *pe; > WaitObjects *w = &wait_objects; > + gint poll_timeout; > static struct timeval tv0; > > /* XXX: need to suppress polling by better using win32 events */ > @@ -424,12 +425,12 @@ static int os_host_main_loop_wait(uint32_t timeout) > if (nfds >= 0) { > ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0); > if (ret != 0) { > - timeout = 0; > + /* TODO. */ > } > } > > g_main_context_prepare(context, &max_priority); > - n_poll_fds = g_main_context_query(context, max_priority, &timeout, > + n_poll_fds = g_main_context_query(context, max_priority, &poll_timeout, > poll_fds, ARRAY_SIZE(poll_fds)); > g_assert(n_poll_fds <= ARRAY_SIZE(poll_fds)); > > @@ -439,7 +440,7 @@ static int os_host_main_loop_wait(uint32_t timeout) > } > > qemu_mutex_unlock_iothread(); > - ret = g_poll(poll_fds, n_poll_fds + w->num, timeout); > + ret = g_poll(poll_fds, n_poll_fds + w->num, poll_timeout); > qemu_mutex_lock_iothread(); > if (ret > 0) { > for (i = 0; i < w->num; i++) { > -- > 1.7.9 > >
Il 27/04/2012 17:02, Stefan Weil ha scritto: > diff --git a/main-loop.c b/main-loop.c > index 0457bf2..24cf540 100644 > --- a/main-loop.c > +++ b/main-loop.c > @@ -410,6 +410,7 @@ static int os_host_main_loop_wait(uint32_t timeout) > int ret, i; > PollingEntry *pe; > WaitObjects *w = &wait_objects; > + gint poll_timeout; > static struct timeval tv0; > > /* XXX: need to suppress polling by better using win32 events */ > @@ -424,12 +425,12 @@ static int os_host_main_loop_wait(uint32_t timeout) > if (nfds >= 0) { > ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0); > if (ret != 0) { > - timeout = 0; > + /* TODO. */ Please leave timeout = 0 here and... > } > } > > g_main_context_prepare(context, &max_priority); > - n_poll_fds = g_main_context_query(context, max_priority, &timeout, > + n_poll_fds = g_main_context_query(context, max_priority, &poll_timeout, > poll_fds, ARRAY_SIZE(poll_fds)); > g_assert(n_poll_fds <= ARRAY_SIZE(poll_fds)); > > @@ -439,7 +440,7 @@ static int os_host_main_loop_wait(uint32_t timeout) > } > > qemu_mutex_unlock_iothread(); > - ret = g_poll(poll_fds, n_poll_fds + w->num, timeout); ... here do: if (poll_timeout == INFINITE || timeout < poll_timeout) { poll_timeout = timeout; } > + ret = g_poll(poll_fds, n_poll_fds + w->num, poll_timeout); > qemu_mutex_lock_iothread(); > if (ret > 0) { > for (i = 0; i < w->num; i++) { Thanks for fixing the breakage. Paolo
Am 28.04.2012 16:34, schrieb Paolo Bonzini: > Il 27/04/2012 17:02, Stefan Weil ha scritto: > >> diff --git a/main-loop.c b/main-loop.c >> index 0457bf2..24cf540 100644 >> --- a/main-loop.c >> +++ b/main-loop.c >> @@ -410,6 +410,7 @@ static int os_host_main_loop_wait(uint32_t timeout) >> int ret, i; >> PollingEntry *pe; >> WaitObjects *w = &wait_objects; >> + gint poll_timeout; >> static struct timeval tv0; >> >> /* XXX: need to suppress polling by better using win32 events */ >> @@ -424,12 +425,12 @@ static int os_host_main_loop_wait(uint32_t timeout) >> if (nfds >= 0) { >> ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0); >> if (ret != 0) { >> - timeout = 0; >> + /* TODO. */ > > Please leave timeout = 0 here and... > >> } >> } >> >> g_main_context_prepare(context, &max_priority); >> - n_poll_fds = g_main_context_query(context, max_priority, &timeout, >> + n_poll_fds = g_main_context_query(context, max_priority, &poll_timeout, >> poll_fds, ARRAY_SIZE(poll_fds)); >> g_assert(n_poll_fds <= ARRAY_SIZE(poll_fds)); >> >> @@ -439,7 +440,7 @@ static int os_host_main_loop_wait(uint32_t timeout) >> } >> >> qemu_mutex_unlock_iothread(); >> - ret = g_poll(poll_fds, n_poll_fds + w->num, timeout); > > ... here do: > > if (poll_timeout == INFINITE || timeout < poll_timeout) { > poll_timeout = timeout; > } With poll_timeout of type gint = int and INFINITE = 0xffffffff, poll_timeout == INFINITE would never be true. What about if (poll_timeout < 0 || timeout < poll_timeout) { According to the glib documentation, "a negative value indicates an infinite timeout". >> + ret = g_poll(poll_fds, n_poll_fds + w->num, poll_timeout); >> qemu_mutex_lock_iothread(); >> if (ret > 0) { >> for (i = 0; i < w->num; i++) { > > Thanks for fixing the breakage. > > Paolo Thanks for your review. Stefan
diff --git a/main-loop.c b/main-loop.c index 0457bf2..24cf540 100644 --- a/main-loop.c +++ b/main-loop.c @@ -410,6 +410,7 @@ static int os_host_main_loop_wait(uint32_t timeout) int ret, i; PollingEntry *pe; WaitObjects *w = &wait_objects; + gint poll_timeout; static struct timeval tv0; /* XXX: need to suppress polling by better using win32 events */ @@ -424,12 +425,12 @@ static int os_host_main_loop_wait(uint32_t timeout) if (nfds >= 0) { ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0); if (ret != 0) { - timeout = 0; + /* TODO. */ } } g_main_context_prepare(context, &max_priority); - n_poll_fds = g_main_context_query(context, max_priority, &timeout, + n_poll_fds = g_main_context_query(context, max_priority, &poll_timeout, poll_fds, ARRAY_SIZE(poll_fds)); g_assert(n_poll_fds <= ARRAY_SIZE(poll_fds)); @@ -439,7 +440,7 @@ static int os_host_main_loop_wait(uint32_t timeout) } qemu_mutex_unlock_iothread(); - ret = g_poll(poll_fds, n_poll_fds + w->num, timeout); + ret = g_poll(poll_fds, n_poll_fds + w->num, poll_timeout); qemu_mutex_lock_iothread(); if (ret > 0) { for (i = 0; i < w->num; i++) {
This patch fixes a build regression with MinGW which was introduced by commit 7c7db75576bd5a31508208f153c5aada64b2c8df. The 3rd argument of g_main_context_query must point to a gint value. Using a pointer to an uint32_t value is wrong. The timeout argument of function os_host_main_loop_wait was never used for w32 / w64. Signed-off-by: Stefan Weil <sw@weilnetz.de> --- main-loop.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)