qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qtest: fix 32-bit build
@ 2012-03-30 17:54 Anthony Liguori
  2012-03-30 17:59 ` Anthony Liguori
  2012-03-30 23:19 ` Eric Blake
  0 siblings, 2 replies; 12+ messages in thread
From: Anthony Liguori @ 2012-03-30 17:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

time_t appears to be an unsigned long so use %ld.

Reported-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 qtest.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/qtest.c b/qtest.c
index 53e2b79..cd7186c 100644
--- a/qtest.c
+++ b/qtest.c
@@ -34,7 +34,7 @@ static int irq_levels[MAX_IRQ];
 static struct timeval start_time;
 static bool qtest_opened;
 
-#define FMT_timeval "%" PRId64 ".%06" PRId64
+#define FMT_timeval "%ld.%06ld"
 
 /**
  * QTest Protocol
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] qtest: fix 32-bit build
  2012-03-30 17:54 [Qemu-devel] [PATCH] qtest: fix 32-bit build Anthony Liguori
@ 2012-03-30 17:59 ` Anthony Liguori
  2012-03-30 18:03   ` Stefan Weil
  2012-03-30 23:19 ` Eric Blake
  1 sibling, 1 reply; 12+ messages in thread
From: Anthony Liguori @ 2012-03-30 17:59 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Stefan Weil, qemu-devel

Applied.  Sorry for the breakage.

Regards,

Anthony Liguori

On 03/30/2012 12:54 PM, Anthony Liguori wrote:
> time_t appears to be an unsigned long so use %ld.
>
> Reported-by: Stefan Weil<weil@mail.berlios.de>
> Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
> ---
>   qtest.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/qtest.c b/qtest.c
> index 53e2b79..cd7186c 100644
> --- a/qtest.c
> +++ b/qtest.c
> @@ -34,7 +34,7 @@ static int irq_levels[MAX_IRQ];
>   static struct timeval start_time;
>   static bool qtest_opened;
>
> -#define FMT_timeval "%" PRId64 ".%06" PRId64
> +#define FMT_timeval "%ld.%06ld"
>
>   /**
>    * QTest Protocol

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] qtest: fix 32-bit build
  2012-03-30 17:59 ` Anthony Liguori
@ 2012-03-30 18:03   ` Stefan Weil
  2012-03-30 18:29     ` Anthony Liguori
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Weil @ 2012-03-30 18:03 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

Am 30.03.2012 19:59, schrieb Anthony Liguori:
> Applied.  Sorry for the breakage.
>
> Regards,
>
> Anthony Liguori

There is a new breakage:

Now it will fail with w64 (which uses 64 bit time_t and
a 32 bit long).

Regards,
Stefan W.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] qtest: fix 32-bit build
  2012-03-30 18:03   ` Stefan Weil
@ 2012-03-30 18:29     ` Anthony Liguori
  2012-03-30 18:55       ` Paolo Bonzini
  0 siblings, 1 reply; 12+ messages in thread
From: Anthony Liguori @ 2012-03-30 18:29 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

On 03/30/2012 01:03 PM, Stefan Weil wrote:
> Am 30.03.2012 19:59, schrieb Anthony Liguori:
>> Applied. Sorry for the breakage.
>>
>> Regards,
>>
>> Anthony Liguori
>
> There is a new breakage:
>
> Now it will fail with w64 (which uses 64 bit time_t and
> a 32 bit long).

That's a bug in w64 (it has a broken ABI).

Do we actually build and run on w64??

Regards,

Anthony Liguori

>
> Regards,
> Stefan W.
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] qtest: fix 32-bit build
  2012-03-30 18:29     ` Anthony Liguori
@ 2012-03-30 18:55       ` Paolo Bonzini
  2012-03-30 19:06         ` Anthony Liguori
  0 siblings, 1 reply; 12+ messages in thread
From: Paolo Bonzini @ 2012-03-30 18:55 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Stefan Weil, qemu-devel

Il 30/03/2012 20:29, Anthony Liguori ha scritto:
>> Now it will fail with w64 (which uses 64 bit time_t and
>> a 32 bit long).
> 
> That's a bug in w64 (it has a broken ABI).
> 
> Do we actually build and run on w64??

It's actually sensible and x32 does the same.  Not too urgent though.

Paolo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] qtest: fix 32-bit build
  2012-03-30 18:55       ` Paolo Bonzini
@ 2012-03-30 19:06         ` Anthony Liguori
  2012-03-30 19:13           ` Paolo Bonzini
  0 siblings, 1 reply; 12+ messages in thread
From: Anthony Liguori @ 2012-03-30 19:06 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Stefan Weil, qemu-devel

On 03/30/2012 01:55 PM, Paolo Bonzini wrote:
> Il 30/03/2012 20:29, Anthony Liguori ha scritto:
>>> Now it will fail with w64 (which uses 64 bit time_t and
>>> a 32 bit long).
>>
>> That's a bug in w64 (it has a broken ABI).
>>
>> Do we actually build and run on w64??
>
> It's actually sensible and x32 does the same.  Not too urgent though.

I don't understand how making a long 32 bit is sensible but...  I sent a patch 
that should at least address q64.

Am not sure what x32 is though.

Regards,

Anthony Liguori

>
> Paolo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] qtest: fix 32-bit build
  2012-03-30 19:06         ` Anthony Liguori
@ 2012-03-30 19:13           ` Paolo Bonzini
  2012-03-30 19:16             ` Anthony Liguori
  2012-03-30 19:57             ` Blue Swirl
  0 siblings, 2 replies; 12+ messages in thread
From: Paolo Bonzini @ 2012-03-30 19:13 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Stefan Weil, qemu-devel

Il 30/03/2012 21:06, Anthony Liguori ha scritto:
> On 03/30/2012 01:55 PM, Paolo Bonzini wrote:
>> Il 30/03/2012 20:29, Anthony Liguori ha scritto:
>>>> Now it will fail with w64 (which uses 64 bit time_t and
>>>> a 32 bit long).
>>>
>>> That's a bug in w64 (it has a broken ABI).
>>>
>>> Do we actually build and run on w64??
>>
>> It's actually sensible and x32 does the same.  Not too urgent though.
> 
> I don't understand how making a long 32 bit is sensible but...  I sent a
> patch that should at least address q64.
> 
> Am not sure what x32 is though.

x32 is 32-bit ABI (with 32-bit pointers and 4GB address space) with the
x86-64 (64-bit) ISA.

Paolo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] qtest: fix 32-bit build
  2012-03-30 19:13           ` Paolo Bonzini
@ 2012-03-30 19:16             ` Anthony Liguori
  2012-03-30 19:23               ` Stefan Weil
  2012-03-30 19:57             ` Blue Swirl
  1 sibling, 1 reply; 12+ messages in thread
From: Anthony Liguori @ 2012-03-30 19:16 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Stefan Weil, qemu-devel

On 03/30/2012 02:13 PM, Paolo Bonzini wrote:
> Il 30/03/2012 21:06, Anthony Liguori ha scritto:
>> On 03/30/2012 01:55 PM, Paolo Bonzini wrote:
>>> Il 30/03/2012 20:29, Anthony Liguori ha scritto:
>>>>> Now it will fail with w64 (which uses 64 bit time_t and
>>>>> a 32 bit long).
>>>>
>>>> That's a bug in w64 (it has a broken ABI).
>>>>
>>>> Do we actually build and run on w64??
>>>
>>> It's actually sensible and x32 does the same.  Not too urgent though.
>>
>> I don't understand how making a long 32 bit is sensible but...  I sent a
>> patch that should at least address q64.
>>
>> Am not sure what x32 is though.
>
> x32 is 32-bit ABI (with 32-bit pointers and 4GB address space) with the
> x86-64 (64-bit) ISA.

Wow.  That's..  interesting :-)

In general, violating sizeof(long) >= sizeof(void *) seems like an exceeding bad 
idea to me.

Regards,

Anthony Liguori

>
> Paolo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] qtest: fix 32-bit build
  2012-03-30 19:16             ` Anthony Liguori
@ 2012-03-30 19:23               ` Stefan Weil
  2012-03-30 19:27                 ` Anthony Liguori
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Weil @ 2012-03-30 19:23 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Paolo Bonzini, qemu-devel

Am 30.03.2012 21:16, schrieb Anthony Liguori:
> On 03/30/2012 02:13 PM, Paolo Bonzini wrote:
>> Il 30/03/2012 21:06, Anthony Liguori ha scritto:
>>> On 03/30/2012 01:55 PM, Paolo Bonzini wrote:
>>>> Il 30/03/2012 20:29, Anthony Liguori ha scritto:
>>>>>> Now it will fail with w64 (which uses 64 bit time_t and
>>>>>> a 32 bit long).
>>>>>
>>>>> That's a bug in w64 (it has a broken ABI).
>>>>>
>>>>> Do we actually build and run on w64??
>>>>
>>>> It's actually sensible and x32 does the same.  Not too urgent though.
>>>
>>> I don't understand how making a long 32 bit is sensible but...  I 
>>> sent a
>>> patch that should at least address q64.
>>>
>>> Am not sure what x32 is though.
>>
>> x32 is 32-bit ABI (with 32-bit pointers and 4GB address space) with the
>> x86-64 (64-bit) ISA.
>
> Wow.  That's..  interesting :-)
>
> In general, violating sizeof(long) >= sizeof(void *) seems like an 
> exceeding bad idea to me.
>
> Regards,
>
> Anthony Liguori

Any 32 bit system will have to use a 64 bit time_t sooner or later
to avoid an overflow. Not only w64 but also w32 supports it.
Future 32 bit Linux versions will also need it.

The size of a long is a different matter.

Regards,
Stefan W.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] qtest: fix 32-bit build
  2012-03-30 19:23               ` Stefan Weil
@ 2012-03-30 19:27                 ` Anthony Liguori
  0 siblings, 0 replies; 12+ messages in thread
From: Anthony Liguori @ 2012-03-30 19:27 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Paolo Bonzini, qemu-devel

On 03/30/2012 02:23 PM, Stefan Weil wrote:
> Am 30.03.2012 21:16, schrieb Anthony Liguori:
>> On 03/30/2012 02:13 PM, Paolo Bonzini wrote:
>>> Il 30/03/2012 21:06, Anthony Liguori ha scritto:
>>>> On 03/30/2012 01:55 PM, Paolo Bonzini wrote:
>>>>> Il 30/03/2012 20:29, Anthony Liguori ha scritto:
>>>>>>> Now it will fail with w64 (which uses 64 bit time_t and
>>>>>>> a 32 bit long).
>>>>>>
>>>>>> That's a bug in w64 (it has a broken ABI).
>>>>>>
>>>>>> Do we actually build and run on w64??
>>>>>
>>>>> It's actually sensible and x32 does the same. Not too urgent though.
>>>>
>>>> I don't understand how making a long 32 bit is sensible but... I sent a
>>>> patch that should at least address q64.
>>>>
>>>> Am not sure what x32 is though.
>>>
>>> x32 is 32-bit ABI (with 32-bit pointers and 4GB address space) with the
>>> x86-64 (64-bit) ISA.
>>
>> Wow. That's.. interesting :-)
>>
>> In general, violating sizeof(long) >= sizeof(void *) seems like an exceeding
>> bad idea to me.
>>
>> Regards,
>>
>> Anthony Liguori
>
> Any 32 bit system will have to use a 64 bit time_t sooner or later
> to avoid an overflow. Not only w64 but also w32 supports it.
> Future 32 bit Linux versions will also need it.
>
> The size of a long is a different matter.

Yet another reason that we all should build bunkers for the upcoming Unix epoch 
overflow apocalypse..  that is, if the machines don't revolt before 2038 ;-)

Regards,

Anthony Liguori

> Regards,
> Stefan W.
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] qtest: fix 32-bit build
  2012-03-30 19:13           ` Paolo Bonzini
  2012-03-30 19:16             ` Anthony Liguori
@ 2012-03-30 19:57             ` Blue Swirl
  1 sibling, 0 replies; 12+ messages in thread
From: Blue Swirl @ 2012-03-30 19:57 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Stefan Weil, qemu-devel, Anthony Liguori

On Fri, Mar 30, 2012 at 19:13, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Il 30/03/2012 21:06, Anthony Liguori ha scritto:
>> On 03/30/2012 01:55 PM, Paolo Bonzini wrote:
>>> Il 30/03/2012 20:29, Anthony Liguori ha scritto:
>>>>> Now it will fail with w64 (which uses 64 bit time_t and
>>>>> a 32 bit long).
>>>>
>>>> That's a bug in w64 (it has a broken ABI).
>>>>
>>>> Do we actually build and run on w64??
>>>
>>> It's actually sensible and x32 does the same.  Not too urgent though.
>>
>> I don't understand how making a long 32 bit is sensible but...  I sent a
>> patch that should at least address q64.
>>
>> Am not sure what x32 is though.
>
> x32 is 32-bit ABI (with 32-bit pointers and 4GB address space) with the
> x86-64 (64-bit) ISA.

By the way, it should be easy to add a user emulator for x32, much
like sparc32plus. Some x86 target_ulongs may need to be changed to
abi_ulongs and wasn't the system call interface different to the 32
bit one?

>
> Paolo
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] qtest: fix 32-bit build
  2012-03-30 17:54 [Qemu-devel] [PATCH] qtest: fix 32-bit build Anthony Liguori
  2012-03-30 17:59 ` Anthony Liguori
@ 2012-03-30 23:19 ` Eric Blake
  1 sibling, 0 replies; 12+ messages in thread
From: Eric Blake @ 2012-03-30 23:19 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

On 03/30/2012 11:54 AM, Anthony Liguori wrote:
> time_t appears to be an unsigned long so use %ld.

Not portable.  POSIX does not guarantee the size of time_t; there are
32-bit platforms where time_t is 64-bit.

The only way to print a time_t value is to cast it through a known-width
type, and seeing as how there are 64-bit time_t on 32-bit platforms,
that pretty much has to be %jd and intmax_t.

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-03-30 23:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-30 17:54 [Qemu-devel] [PATCH] qtest: fix 32-bit build Anthony Liguori
2012-03-30 17:59 ` Anthony Liguori
2012-03-30 18:03   ` Stefan Weil
2012-03-30 18:29     ` Anthony Liguori
2012-03-30 18:55       ` Paolo Bonzini
2012-03-30 19:06         ` Anthony Liguori
2012-03-30 19:13           ` Paolo Bonzini
2012-03-30 19:16             ` Anthony Liguori
2012-03-30 19:23               ` Stefan Weil
2012-03-30 19:27                 ` Anthony Liguori
2012-03-30 19:57             ` Blue Swirl
2012-03-30 23:19 ` Eric Blake

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).