* [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
* 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
* 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
1 sibling, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2007-09-16 16:35 UTC (permalink / raw)
To: sol10x86; +Cc: qemu-devel
Ben Taylor <sol10x86@cox.net> writes:
> ---- 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.
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.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ 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
1 sibling, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2007-09-16 17:18 UTC (permalink / raw)
To: Ben Taylor; +Cc: qemu-devel
Hi,
On Sun, 16 Sep 2007, Ben Taylor wrote:
> ---- Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> > 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.
I fear _I_ may not have made myself very clear. What I meant was: why not
check if ULONG_LONG_MAX is undefined, instead of checking if __sun__ is
defined? That way, more than one platform might benefit from this change.
Just an idea,
Dscho
^ permalink raw reply [flat|nested] 6+ messages in thread
* 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
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-15 21:53 [Qemu-devel] Comment for Solaris fix for the HPTC Ben Taylor
2007-09-15 22:23 ` Johannes Schindelin
-- 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-17 9:12 Juergen Keil
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).