[PATCH 2/3] defs: define PRI__[uxs]64 to print __[su]64 values

Dmitry V. Levin ldv at altlinux.org
Thu Mar 31 03:01:09 UTC 2016


On Wed, Mar 30, 2016 at 10:28:35PM -0400, Jeff Mahoney wrote:
> On 3/30/16 9:55 PM, Dmitry V. Levin wrote:
> > On Wed, Mar 30, 2016 at 09:19:26PM -0400, Jeff Mahoney wrote:
> > [...]
> >> +/*
> >> + * The kernel used to define 64-bit types on 64-bit systems on a per-arch
> >> + * basis.  Some architectures would use unsigned long and others would u=
> > se
> >> + * unsigned long long.  These types were exported as part of the
> >> + * kernel-userspace ABI and now must be maintained forever.  This matches
> >> + * what the kernel exports for each architecture so we don't need to cast
> >> + * every printing of __u64 or __s64 to stdint types.
> >> + */
> >> +#if BITS_PER_LONG =3D=3D 32
> >> +#define PRI__64 "ll"
> > 
> > How portable is BITS_PER_LONG?
> 
> Both asm/int-l64.h and asm/int-ll64.h include asm/bitsperlong.h, so if
> __u64 is defined, so will BITS_PER_LONG.

Remember this is defs.h included by virtually every source file.
What will happen if __u64 is not defined?

In other words, I'd be more comfortable with SIZEOF_LONG prodiced by
AC_CHECK_SIZEOF([long]) in configure.ac.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160331/9943ba5e/attachment.bin>


More information about the Strace-devel mailing list