* [Qemu-devel] [PATCH for-1.6] qemu-timer: fix get_clock() gettimeofday() fallback #ifdef
@ 2013-08-06 11:48 Stefan Hajnoczi
2013-08-07 0:26 ` Brad Smith
2013-09-24 21:58 ` [Qemu-devel] [Qemu-stable] " Michael Roth
0 siblings, 2 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2013-08-06 11:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Anthony Liguori, qemu-stable, Stefan Hajnoczi
If CLOCK_MONOTONIC is not defined by system headers we use
gettimeofday(2). Apparently this is not used very often since no one
noticed the #ifdef was actually broken and left the function definition
unterminated.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
include/qemu/timer.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 9dd206c..e3299b8 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -125,8 +125,8 @@ static inline int64_t get_clock(void)
changes, so it should be avoided. */
return get_clock_realtime();
}
-}
#endif
+}
void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.6] qemu-timer: fix get_clock() gettimeofday() fallback #ifdef
2013-08-06 11:48 [Qemu-devel] [PATCH for-1.6] qemu-timer: fix get_clock() gettimeofday() fallback #ifdef Stefan Hajnoczi
@ 2013-08-07 0:26 ` Brad Smith
2013-08-07 7:53 ` Stefan Hajnoczi
2013-09-24 21:58 ` [Qemu-devel] [Qemu-stable] " Michael Roth
1 sibling, 1 reply; 5+ messages in thread
From: Brad Smith @ 2013-08-07 0:26 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Anthony Liguori, qemu-devel, qemu-stable
On 06/08/13 7:48 AM, Stefan Hajnoczi wrote:
> If CLOCK_MONOTONIC is not defined by system headers we use
> gettimeofday(2). Apparently this is not used very often since no one
> noticed the #ifdef was actually broken and left the function definition
> unterminated.
Can you show what this supposedly fixes? This code built just fine on
OpenBSD before d05ef160453e98546a4197496dc8a3cb2defac53.
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> include/qemu/timer.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/qemu/timer.h b/include/qemu/timer.h
> index 9dd206c..e3299b8 100644
> --- a/include/qemu/timer.h
> +++ b/include/qemu/timer.h
> @@ -125,8 +125,8 @@ static inline int64_t get_clock(void)
> changes, so it should be avoided. */
> return get_clock_realtime();
> }
> -}
> #endif
> +}
>
> void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
> void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);
>
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.6] qemu-timer: fix get_clock() gettimeofday() fallback #ifdef
2013-08-07 0:26 ` Brad Smith
@ 2013-08-07 7:53 ` Stefan Hajnoczi
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2013-08-07 7:53 UTC (permalink / raw)
To: Brad Smith; +Cc: Anthony Liguori, qemu-devel, Stefan Hajnoczi, qemu-stable
On Tue, Aug 06, 2013 at 08:26:16PM -0400, Brad Smith wrote:
> On 06/08/13 7:48 AM, Stefan Hajnoczi wrote:
> >If CLOCK_MONOTONIC is not defined by system headers we use
> >gettimeofday(2). Apparently this is not used very often since no one
> >noticed the #ifdef was actually broken and left the function definition
> >unterminated.
>
> Can you show what this supposedly fixes? This code built just fine on
> OpenBSD before d05ef160453e98546a4197496dc8a3cb2defac53.
Hi Brad, thanks for pointing this out. I misread the code:
static inline int64_t get_clock(void)
{
#ifdef CLOCK_MONOTONIC
if (use_rt_clock) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec * 1000000000LL + ts.tv_nsec;
} else
#endif <--- thought this was #else
{
/* XXX: using gettimeofday leads to problems if the date
changes, so it should be avoided. */
return get_clock_realtime();
}
}
#endif <--- this is actually for #ifdef _WIN32
So I thought the function definition would not be terminated properly. But
after you mentioned it, my change makes no sense.
Dropping this patch.
Thanks,
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-stable] [PATCH for-1.6] qemu-timer: fix get_clock() gettimeofday() fallback #ifdef
2013-08-06 11:48 [Qemu-devel] [PATCH for-1.6] qemu-timer: fix get_clock() gettimeofday() fallback #ifdef Stefan Hajnoczi
2013-08-07 0:26 ` Brad Smith
@ 2013-09-24 21:58 ` Michael Roth
2013-09-24 21:59 ` Michael Roth
1 sibling, 1 reply; 5+ messages in thread
From: Michael Roth @ 2013-09-24 21:58 UTC (permalink / raw)
To: Stefan Hajnoczi, qemu-devel; +Cc: qemu-trivial, Anthony Liguori, qemu-stable
Quoting Stefan Hajnoczi (2013-08-06 06:48:58)
> If CLOCK_MONOTONIC is not defined by system headers we use
> gettimeofday(2). Apparently this is not used very often since no one
> noticed the #ifdef was actually broken and left the function definition
> unterminated.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Ping, looking to pull this in for stable.
> ---
> include/qemu/timer.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/qemu/timer.h b/include/qemu/timer.h
> index 9dd206c..e3299b8 100644
> --- a/include/qemu/timer.h
> +++ b/include/qemu/timer.h
> @@ -125,8 +125,8 @@ static inline int64_t get_clock(void)
> changes, so it should be avoided. */
> return get_clock_realtime();
> }
> -}
> #endif
> +}
>
> void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
> void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);
> --
> 1.8.1.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-stable] [PATCH for-1.6] qemu-timer: fix get_clock() gettimeofday() fallback #ifdef
2013-09-24 21:58 ` [Qemu-devel] [Qemu-stable] " Michael Roth
@ 2013-09-24 21:59 ` Michael Roth
0 siblings, 0 replies; 5+ messages in thread
From: Michael Roth @ 2013-09-24 21:59 UTC (permalink / raw)
To: Stefan Hajnoczi, qemu-devel; +Cc: qemu-trivial, Anthony Liguori, qemu-stable
Quoting Michael Roth (2013-09-24 16:58:22)
> Quoting Stefan Hajnoczi (2013-08-06 06:48:58)
> > If CLOCK_MONOTONIC is not defined by system headers we use
> > gettimeofday(2). Apparently this is not used very often since no one
> > noticed the #ifdef was actually broken and left the function definition
> > unterminated.
> >
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
>
> Ping, looking to pull this in for stable.
Bah, ignore this. Didn't see previous discussion.
>
> > ---
> > include/qemu/timer.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/qemu/timer.h b/include/qemu/timer.h
> > index 9dd206c..e3299b8 100644
> > --- a/include/qemu/timer.h
> > +++ b/include/qemu/timer.h
> > @@ -125,8 +125,8 @@ static inline int64_t get_clock(void)
> > changes, so it should be avoided. */
> > return get_clock_realtime();
> > }
> > -}
> > #endif
> > +}
> >
> > void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
> > void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);
> > --
> > 1.8.1.4
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-09-24 22:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-06 11:48 [Qemu-devel] [PATCH for-1.6] qemu-timer: fix get_clock() gettimeofday() fallback #ifdef Stefan Hajnoczi
2013-08-07 0:26 ` Brad Smith
2013-08-07 7:53 ` Stefan Hajnoczi
2013-09-24 21:58 ` [Qemu-devel] [Qemu-stable] " Michael Roth
2013-09-24 21:59 ` Michael Roth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).