Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 May 2006 22:39:32 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Maxim Konovalov <maxim@macomnet.ru>
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/98141: [patch] Update for regression/sockets/unix_cmsg
Message-ID:  <20060531221622.I30824@delplex.bde.org>
In-Reply-To: <200605301350.k4UDoIAj049864@freefall.freebsd.org>
References:  <200605301350.k4UDoIAj049864@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Tue, 30 May 2006, Maxim Konovalov wrote:

> > o	Use PRIdMAX macro for outputting intmax_t values.
>
> What is it for?  I see nothing is using this macro in the base system
> and it is defined as "jd" on all our platforms.

Unfortunately, the PRI* mistake is used in a few places in the base system.
At least:

libc_r/test/
fsck_ffs/ (of all places)
find/
getconf/
memcontrol/

Its use in find/ is an especially good example of how not to use it.
In fsck_ffs/, PRI_i64 is used to print some types that are certain to
match, but in find/ PRI_i64 is used to print st_blocks and st_size which
have opaque types.  st_blocks happens to have type int64_t, but POSIX
reqires it to have type blkcnt_t which can be any signed integer type.
st_size has type off_t which happens to match.  find/ also prints st_ino
using a cast to u_long on the same line that it prints st_blocks without
a cast.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060531221622.I30824>