Skip to contentSkip to conversation

qtest: fix 32-bit build

PATCH Applied Anthony Liguori 6 participants 12 messages Mar 30, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qtest: fix 32-bit build

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

---
 qtest.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
qtest.c +1 -1
index 53e2b79..cd7186c 100644
@@ -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
Signature · 1 line
1.7.5.4
#1 lore raw

Applied. Sorry for the breakage.

Regards,

Anthony Liguori

Quoted 21 lines · Anthony Liguori

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

---
  qtest.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
qtest.c +1 -1
index 53e2b79..cd7186c 100644
@@ -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
#2 lore raw

Am 30.03.2012 19:59, schrieb Anthony Liguori:

Quoted 5 lines

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.

#3 lore raw
Quoted 11 lines · Stefan Weil

Am 30.03.2012 19:59, schrieb Anthony Liguori:

Quoted 5 lines

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

Quoted 4 lines

Regards,
Stefan W.

#4 lore raw

Il 30/03/2012 20:29, Anthony Liguori ha scritto:

Quoted 6 lines
Quoted 2 lines

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

#5 lore raw
Quoted 9 lines · Paolo Bonzini

Il 30/03/2012 20:29, Anthony Liguori ha scritto:

Quoted 6 lines
Quoted 2 lines

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

Quoted 2 lines

Paolo

#6 lore raw

Il 30/03/2012 21:06, Anthony Liguori ha scritto:

Quoted 7 lines · Paolo Bonzini
Quoted 6 lines

Il 30/03/2012 20:29, Anthony Liguori ha scritto:

Quoted 5 lines
Quoted 2 lines

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

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

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

#7 lore raw
Quoted 12 lines · Paolo Bonzini

Il 30/03/2012 21:06, Anthony Liguori ha scritto:

Quoted 11 lines · Paolo Bonzini
Quoted 9 lines

Il 30/03/2012 20:29, Anthony Liguori ha scritto:

Quoted 6 lines
Quoted 2 lines

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.

Quoted 7 lines
Quoted 4 lines

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

Quoted 2 lines

Paolo

#8 lore raw

Am 30.03.2012 21:16, schrieb Anthony Liguori:

Quoted 21 lines · Paolo Bonzini
Quoted 12 lines

Il 30/03/2012 21:06, Anthony Liguori ha scritto:

Quoted 11 lines · Paolo Bonzini
Quoted 9 lines

Il 30/03/2012 20:29, Anthony Liguori ha scritto:

Quoted 6 lines
Quoted 2 lines

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.

Quoted 7 lines
Quoted 4 lines

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.

Quoted 7 lines

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.

#9 lore raw
Quoted 29 lines · Stefan Weil

Am 30.03.2012 21:16, schrieb Anthony Liguori:

Quoted 28 lines · Paolo Bonzini
Quoted 12 lines

Il 30/03/2012 21:06, Anthony Liguori ha scritto:

Quoted 11 lines · Paolo Bonzini
Quoted 9 lines

Il 30/03/2012 20:29, Anthony Liguori ha scritto:

Quoted 6 lines
Quoted 2 lines

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.

Quoted 7 lines
Quoted 4 lines

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,

Quoted 7 lines
Quoted 1 line

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

Quoted 3 lines

Regards,
Stefan W.

#10 lore raw
In reply to Paolo Bonzini
Quoted 12 lines · Paolo Bonzini

Il 30/03/2012 21:06, Anthony Liguori ha scritto:

Quoted 11 lines · Paolo Bonzini
Quoted 9 lines

Il 30/03/2012 20:29, Anthony Liguori ha scritto:

Quoted 6 lines
Quoted 2 lines

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.

Quoted 7 lines
Quoted 4 lines

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?

Quoted 3 lines

Paolo

#11 lore raw
In reply to Anthony Liguori
Quoted 1 line · Anthony Liguori

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.

Signature · 2 lines
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org