bin/98141: [patch] Update for regression/sockets/unix_cmsg

Bruce Evans bde at zeta.org.au
Wed May 31 05:39:40 PDT 2006


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


More information about the freebsd-bugs mailing list