Patchwork qtest: Fix tv_usec != long

login
register
mail settings
Submitter Richard Henderson
Date April 19, 2012, 12:09 p.m.
Message ID <1334837373-30470-1-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/153730/
State New
Headers show

Comments

Richard Henderson - April 19, 2012, 12:09 p.m.
Sparc Debian 5.0.8 does not define __suseconds_t as long,
but FMT_timeval expects %ld.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
 qtest.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Paolo Bonzini - April 19, 2012, 12:20 p.m.
Il 19/04/2012 14:09, Richard Henderson ha scritto:
> Sparc Debian 5.0.8 does not define __suseconds_t as long,
> but FMT_timeval expects %ld.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> Cc: Anthony Liguori <aliguori@us.ibm.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  qtest.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Blue Swirl - April 19, 2012, 5:04 p.m.
On Thu, Apr 19, 2012 at 12:09, Richard Henderson <rth@twiddle.net> wrote:
> Sparc Debian 5.0.8 does not define __suseconds_t as long,
> but FMT_timeval expects %ld.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> Cc: Anthony Liguori <aliguori@us.ibm.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  qtest.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/qtest.c b/qtest.c
> index 18afcd9..fbfab4e 100644
> --- a/qtest.c
> +++ b/qtest.c
> @@ -153,7 +153,7 @@ static void qtest_send_prefix(CharDriverState *chr)
>
>     qtest_get_time(&tv);
>     fprintf(qtest_log_fp, "[S +" FMT_timeval "] ",
> -            tv.tv_sec, tv.tv_usec);
> +            tv.tv_sec, (long) tv.tv_usec);

Instead of the casts, can't we fix FMT_timeval?

>  }
>
>  static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr,
> @@ -201,7 +201,7 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)
>
>         qtest_get_time(&tv);
>         fprintf(qtest_log_fp, "[R +" FMT_timeval "]",
> -                tv.tv_sec, tv.tv_usec);
> +                tv.tv_sec, (long) tv.tv_usec);
>         for (i = 0; words[i]; i++) {
>             fprintf(qtest_log_fp, " %s", words[i]);
>         }
> @@ -399,7 +399,7 @@ static void qtest_event(void *opaque, int event)
>         qtest_opened = true;
>         if (qtest_log_fp) {
>             fprintf(qtest_log_fp, "[I " FMT_timeval "] OPENED\n",
> -                    start_time.tv_sec, start_time.tv_usec);
> +                    start_time.tv_sec, (long) start_time.tv_usec);
>         }
>         break;
>     case CHR_EVENT_CLOSED:
> @@ -408,7 +408,7 @@ static void qtest_event(void *opaque, int event)
>             qemu_timeval tv;
>             qtest_get_time(&tv);
>             fprintf(qtest_log_fp, "[I +" FMT_timeval "] CLOSED\n",
> -                    tv.tv_sec, tv.tv_usec);
> +                    tv.tv_sec, (long) tv.tv_usec);
>         }
>         break;
>     default:
> --
> 1.7.7.6
>
>
Richard Henderson - April 19, 2012, 6:25 p.m.
On 04/19/2012 12:04 PM, Blue Swirl wrote:
>> > -            tv.tv_sec, tv.tv_usec);
>> > +            tv.tv_sec, (long) tv.tv_usec);
> Instead of the casts, can't we fix FMT_timeval?
> 

Without truly ugly configure detection, I sincerely doubt it.


r~
Anthony Liguori - April 24, 2012, 6:23 p.m.
On 04/19/2012 07:09 AM, Richard Henderson wrote:
> Sparc Debian 5.0.8 does not define __suseconds_t as long,
> but FMT_timeval expects %ld.
>
> Signed-off-by: Richard Henderson<rth@twiddle.net>
> Cc: Anthony Liguori<aliguori@us.ibm.com>
> Cc: Paolo Bonzini<pbonzini@redhat.com>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   qtest.c |    8 ++++----
>   1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/qtest.c b/qtest.c
> index 18afcd9..fbfab4e 100644
> --- a/qtest.c
> +++ b/qtest.c
> @@ -153,7 +153,7 @@ static void qtest_send_prefix(CharDriverState *chr)
>
>       qtest_get_time(&tv);
>       fprintf(qtest_log_fp, "[S +" FMT_timeval "] ",
> -            tv.tv_sec, tv.tv_usec);
> +            tv.tv_sec, (long) tv.tv_usec);
>   }
>
>   static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr,
> @@ -201,7 +201,7 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)
>
>           qtest_get_time(&tv);
>           fprintf(qtest_log_fp, "[R +" FMT_timeval "]",
> -                tv.tv_sec, tv.tv_usec);
> +                tv.tv_sec, (long) tv.tv_usec);
>           for (i = 0; words[i]; i++) {
>               fprintf(qtest_log_fp, " %s", words[i]);
>           }
> @@ -399,7 +399,7 @@ static void qtest_event(void *opaque, int event)
>           qtest_opened = true;
>           if (qtest_log_fp) {
>               fprintf(qtest_log_fp, "[I " FMT_timeval "] OPENED\n",
> -                    start_time.tv_sec, start_time.tv_usec);
> +                    start_time.tv_sec, (long) start_time.tv_usec);
>           }
>           break;
>       case CHR_EVENT_CLOSED:
> @@ -408,7 +408,7 @@ static void qtest_event(void *opaque, int event)
>               qemu_timeval tv;
>               qtest_get_time(&tv);
>               fprintf(qtest_log_fp, "[I +" FMT_timeval "] CLOSED\n",
> -                    tv.tv_sec, tv.tv_usec);
> +                    tv.tv_sec, (long) tv.tv_usec);
>           }
>           break;
>       default:

Patch

diff --git a/qtest.c b/qtest.c
index 18afcd9..fbfab4e 100644
--- a/qtest.c
+++ b/qtest.c
@@ -153,7 +153,7 @@  static void qtest_send_prefix(CharDriverState *chr)
 
     qtest_get_time(&tv);
     fprintf(qtest_log_fp, "[S +" FMT_timeval "] ",
-            tv.tv_sec, tv.tv_usec);
+            tv.tv_sec, (long) tv.tv_usec);
 }
 
 static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr,
@@ -201,7 +201,7 @@  static void qtest_process_command(CharDriverState *chr, gchar **words)
 
         qtest_get_time(&tv);
         fprintf(qtest_log_fp, "[R +" FMT_timeval "]",
-                tv.tv_sec, tv.tv_usec);
+                tv.tv_sec, (long) tv.tv_usec);
         for (i = 0; words[i]; i++) {
             fprintf(qtest_log_fp, " %s", words[i]);
         }
@@ -399,7 +399,7 @@  static void qtest_event(void *opaque, int event)
         qtest_opened = true;
         if (qtest_log_fp) {
             fprintf(qtest_log_fp, "[I " FMT_timeval "] OPENED\n",
-                    start_time.tv_sec, start_time.tv_usec);
+                    start_time.tv_sec, (long) start_time.tv_usec);
         }
         break;
     case CHR_EVENT_CLOSED:
@@ -408,7 +408,7 @@  static void qtest_event(void *opaque, int event)
             qemu_timeval tv;
             qtest_get_time(&tv);
             fprintf(qtest_log_fp, "[I +" FMT_timeval "] CLOSED\n",
-                    tv.tv_sec, tv.tv_usec);
+                    tv.tv_sec, (long) tv.tv_usec);
         }
         break;
     default: