From owner-freebsd-hackers@FreeBSD.ORG Sat Sep 18 15:30:52 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B44B106566C for ; Sat, 18 Sep 2010 15:30:52 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id EDACD8FC17 for ; Sat, 18 Sep 2010 15:30:51 +0000 (UTC) Received: by iwn34 with SMTP id 34so3412455iwn.13 for ; Sat, 18 Sep 2010 08:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=qEzrj+z/ZxgA+AlwhN+SwIBRyayXTx5qDaFIep448oY=; b=s+Oo90rnNJh+oFuhuAhfjBWjfo0nmpLI44fZa1agXtlVS4AFCKSHdTN9yqQKP3+V+l bxsdgVOO7ZMzo65O7HlaaKM5E51sfiusKcmXzLudqnQl8cKSDpdkHN9cvB/ZqoMWAJWF WyxjWKgPn++VDEBeqfpzSB84LOgD7CcyUS9uI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=GtPl3u1AZTDtIMCNqKL1gU/UMVs53mGQOBv7ihx7wzRbEGiCxt7rwjR/Hd759/00pb 0nHzyuDIzHQEPJZJ5J4xi+DCEP+E7pe3jIn3p3K3AUWPBBAI79aSysx3q16wyo7bzH4E ysYJtTQG7lE8fExMYhjYfVC1aX1qfAf5QbBSA= MIME-Version: 1.0 Received: by 10.231.193.135 with SMTP id du7mr6087557ibb.176.1284823851253; Sat, 18 Sep 2010 08:30:51 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.231.11.133 with HTTP; Sat, 18 Sep 2010 08:30:51 -0700 (PDT) In-Reply-To: References: <4C93236B.4050906@freebsd.org> <4C935F56.4030903@freebsd.org> <20100918143516.3568f40e@r500.local> Date: Sat, 18 Sep 2010 08:30:51 -0700 X-Google-Sender-Auth: qg-NKjrSM8pHGrs2OZblCgKXerA Message-ID: From: Garrett Cooper To: "Robert N. M. Watson" Content-Type: multipart/mixed; boundary=00504501751940c0ea04908a5de9 Cc: freebsd-hackers@freebsd.org, Fabian Keil Subject: Re: zfs + uma X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2010 15:30:52 -0000 --00504501751940c0ea04908a5de9 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Sat, Sep 18, 2010 at 6:52 AM, Robert N. M. Watson wrote: > > On 18 Sep 2010, at 13:35, Fabian Keil wrote: > >> Doesn't build for me on amd64: >> >> fk@r500 /usr/src/tools/tools/umastat $make >> Warning: Object directory not changed from original /usr/src/tools/tools= /umastat >> cc -O2 -pipe =A0-fno-omit-frame-pointer -std=3Dgnu99 -fstack-protector -= Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wst= rict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wn= o-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 i= nt', but argument 3 has type 'uint64_t' >> umastat.c:234: warning: format '%llu' expects type 'long long unsigned i= nt', 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 i= nt', but argument 3 has type 'u_int64_t' >> umastat.c:246: warning: format '%llu' expects type 'long long unsigned i= nt', but argument 3 has type 'u_int64_t' >> umastat.c: In function 'main': >> umastat.c:416: warning: format '%llu' expects type 'long long unsigned i= nt', but argument 2 has type 'u_int64_t' >> umastat.c:418: warning: format '%llu' expects type 'long long unsigned i= nt', but argument 2 has type 'u_int64_t' >> umastat.c:420: warning: format '%llu' expects type 'long long unsigned i= nt', but argument 2 has type 'u_int64_t' >> umastat.c:426: warning: dereferencing type-punned pointer will break str= ict-aliasing rules >> umastat.c:429: warning: dereferencing type-punned pointer will break str= ict-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 c= onverted 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)). 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 nbyte= s); but that's a different topic to look at later, if it really matters to anyo= ne. Thanks, -Garrett --00504501751940c0ea04908a5de9 Content-Type: application/octet-stream; name="umastat-64bit.diff" Content-Disposition: attachment; filename="umastat-64bit.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ge8mva1o0 SW5kZXg6IHVtYXN0YXQuYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSB1bWFzdGF0LmMJKHJldmlzaW9uIDIxMjIy MykKKysrIHVtYXN0YXQuYwkod29ya2luZyBjb3B5KQpAQCAtMzYsNiArMzYsNyBAQAogI2luY2x1 ZGUgPHZtL3VtYV9pbnQuaD4KIAogI2luY2x1ZGUgPGVyci5oPgorI2luY2x1ZGUgPGludHR5cG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