qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] Comment for Solaris fix for the HPTC
@ 2007-09-17  9:12 Juergen Keil
  0 siblings, 0 replies; 6+ messages in thread
From: Juergen Keil @ 2007-09-17  9:12 UTC (permalink / raw)
  To: qemu-devel


Andreas Schwab wrote:

> Your reference to ULONG_MAX is a red herring.  ULONG_MAX is the limit
> for unsigned long, and ULONG_LONG_MAX is the limit for unsigned long
> long.  If your compiler does not support the long long type then
> ULONG_LONG_MAX should not be defined either.  Instead, vl.c should use
> UINT64_MAX.

Looking at a (draft) c99 standard document, I don't find any references
for an ULONG_LONG_MAX macro, anyway.  The c99 <limits.h> header is supposed 
to define LLONG_MIN, LLONG_MAX and ULLONG_MAX for the "long long" and
"unsigned long long" type limits...

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Comment for Solaris fix for the HPTC
@ 2007-09-16 15:11 Ben Taylor
  2007-09-16 16:35 ` Andreas Schwab
  2007-09-16 17:18 ` Johannes Schindelin
  0 siblings, 2 replies; 6+ messages in thread
From: Ben Taylor @ 2007-09-16 15:11 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: qemu-devel


---- Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: 
> Hi Ben,
> 
> On Sat, 15 Sep 2007, Ben Taylor wrote:
> 
> > +#ifdef __sun__
> > +/* Have to define this for Solaris as ULONG_LONG_MAX is not defined
> > +   anywhere.  ULONG_MAX is correct only on _LP64 systems */
> > +#define ULONG_LONG_MAX 18446744073709551615UL
> > +#endif
> > +
> 
> These constants are always defined, right?  So why not "#ifndef 
> ULONG_LONG_MAX"?

I fear I may not have explained this well.

On the Solaris systems I have access to, I find no system include file
that defines "ULONG_LONG_MAX".

There are defines for ULONG_MAX which is equivilent to the value that
ULONG_LONG_MAX is, but only when the system is being compiled on
an "_LP64" (ie x86_64) system.  When the system is 32-bit, ULONG_MAX
defaults to a typical max value for a 32-bit unsigned int.

That help?

Ben

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [Qemu-devel] Comment for Solaris fix for the HPTC
@ 2007-09-15 21:53 Ben Taylor
  2007-09-15 22:23 ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Taylor @ 2007-09-15 21:53 UTC (permalink / raw)
  To: qemu-devel


Compiling the latest CVS code, I found that a function in vl.c uses a define
called ULONG_LONG_MAX.  The value is defined in solaris's sys/types.h,
but only on _LP64 builds, so 32-bit builds won't pickup if I redefine it as 
ULONG_MAX.

I'm looking for comments on this patch.

--- qemu.ORIG/vl.h      2007-08-26 13:46:00.000000000 -0400
+++ qemu/vl.h   2007-09-15 17:59:24.179299000 -0400
@@ -49,6 +49,12 @@
 #define ENOMEDIUM ENODEV
 #endif

+#ifdef __sun__
+/* Have to define this for Solaris as ULONG_LONG_MAX is not defined
+   anywhere.  ULONG_MAX is correct only on _LP64 systems */
+#define ULONG_LONG_MAX 18446744073709551615UL
+#endif
+
 #ifdef _WIN32
 #include <windows.h>
 #define fsync _commit

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

end of thread, other threads:[~2007-09-17  9:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-17  9:12 [Qemu-devel] Comment for Solaris fix for the HPTC Juergen Keil
  -- strict thread matches above, loose matches on Subject: below --
2007-09-16 15:11 Ben Taylor
2007-09-16 16:35 ` Andreas Schwab
2007-09-16 17:18 ` Johannes Schindelin
2007-09-15 21:53 Ben Taylor
2007-09-15 22:23 ` Johannes Schindelin

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