Re: [Qemu-devel] Comment for Solaris fix for the HPTC
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...
Re: [Qemu-devel] Comment for Solaris fix for the HPTC
Johannes Schindelin [EMAIL PROTECTED] 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
Re: [Qemu-devel] Comment for Solaris fix for the HPTC
Ben Taylor [EMAIL PROTECTED] writes: Johannes Schindelin [EMAIL PROTECTED] 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, [EMAIL PROTECTED] 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.
Re: [Qemu-devel] Comment for Solaris fix for the HPTC
Hi, On Sun, 16 Sep 2007, Ben Taylor wrote: Johannes Schindelin [EMAIL PROTECTED] 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
[Qemu-devel] Comment for Solaris fix for the HPTC
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.0 -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
Re: [Qemu-devel] Comment for Solaris fix for the HPTC
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? Ciao, Dscho