zfs + uma

Garrett Cooper gcooper at FreeBSD.org
Sat Sep 18 15:30:52 UTC 2010


On Sat, Sep 18, 2010 at 6:52 AM, Robert N. M. Watson
<rwatson at freebsd.org> wrote:
>
> On 18 Sep 2010, at 13:35, Fabian Keil wrote:
>
>> Doesn't build for me on amd64:
>>
>> fk at r500 /usr/src/tools/tools/umastat $make
>> Warning: Object directory not changed from original /usr/src/tools/tools/umastat
>> cc -O2 -pipe  -fno-omit-frame-pointer -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -c umastat.c
>> cc1: warnings being treated as errors
>> umastat.c: In function 'uma_print_bucketlist':
>> umastat.c:234: warning: format '%llu' expects type 'long long unsigned int', but argument 3 has type 'uint64_t'
>> umastat.c:234: warning: format '%llu' expects type 'long long unsigned int', but argument 4 has type 'uint64_t'
>> umastat.c: In function 'uma_print_cache':
>> umastat.c:245: warning: format '%llu' expects type 'long long unsigned int', but argument 3 has type 'u_int64_t'
>> umastat.c:246: warning: format '%llu' expects type 'long long unsigned int', but argument 3 has type 'u_int64_t'
>> umastat.c: In function 'main':
>> umastat.c:416: warning: format '%llu' expects type 'long long unsigned int', but argument 2 has type 'u_int64_t'
>> umastat.c:418: warning: format '%llu' expects type 'long long unsigned int', but argument 2 has type 'u_int64_t'
>> umastat.c:420: warning: format '%llu' expects type 'long long unsigned int', but argument 2 has type 'u_int64_t'
>> umastat.c:426: warning: dereferencing type-punned pointer will break strict-aliasing rules
>> umastat.c:429: warning: dereferencing type-punned pointer will break strict-aliasing rules
>> *** Error code 1
>>
>> Stop in /usr/src/tools/tools/umastat.
>>
>> The attached patch seems to work around the problem, I'm not sure if
>> the casts to void* are better than decreasing the WARN level, though ...
>
> This is a 32-bit/64-bit issue. Probably all pointers printing should be converted to %p, and large integer types to %ju and %jd, perhaps with a cast first to intmax_t or uintmax_t if required.

All types were explicitly declared as u_int64_t, so I'd try this
instead with PRIu64. Very few spots in the code today use void * (and
the ones that do interface with kvm_read(3)).

<OT>
FWIW, kvm_read taking the second argument as unsigned long instead of
void* seems a bit inconsistent:

     ssize_t
     kvm_read(kvm_t *kd, unsigned long addr, void *buf, size_t nbytes);

     ssize_t
     kvm_write(kvm_t *kd, unsigned long addr, const void *buf, size_t nbytes);

but that's a different topic to look at later, if it really matters to anyone.
</OT>

Thanks,
-Garrett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: umastat-64bit.diff
Type: application/octet-stream
Size: 1510 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20100918/3b659ab9/umastat-64bit.obj


More information about the freebsd-hackers mailing list