From owner-freebsd-bugs@FreeBSD.ORG Wed Apr 28 17:20:01 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EDDB1065673 for ; Wed, 28 Apr 2010 17:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5207A8FC16 for ; Wed, 28 Apr 2010 17:20:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o3SHK1jx016306 for ; Wed, 28 Apr 2010 17:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o3SHK1uU016305; Wed, 28 Apr 2010 17:20:01 GMT (envelope-from gnats) Resent-Date: Wed, 28 Apr 2010 17:20:01 GMT Resent-Message-Id: <201004281720.o3SHK1uU016305@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, pluknet Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79EB6106564A for ; Wed, 28 Apr 2010 17:13:24 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 5EA748FC19 for ; Wed, 28 Apr 2010 17:13:24 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o3SHDOqe058412 for ; Wed, 28 Apr 2010 17:13:24 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o3SHDODL058411; Wed, 28 Apr 2010 17:13:24 GMT (envelope-from nobody) Message-Id: <201004281713.o3SHDODL058411@www.freebsd.org> Date: Wed, 28 Apr 2010 17:13:24 GMT From: pluknet To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/146119: [patch] (attempt to) cleanup tools/tools/umastat X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Apr 2010 17:20:01 -0000 >Number: 146119 >Category: misc >Synopsis: [patch] (attempt to) cleanup tools/tools/umastat >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Apr 28 17:20:00 UTC 2010 >Closed-Date: >Last-Modified: >Originator: pluknet >Release: HEAD r207204 >Organization: >Environment: >Description: 1) printf() modifiers on LP64 2) warning "dereferencing type-punned pointer will break strict-aliasing rules" I had to change cast (struct bucketlist *) to (void *) to shut up this warning without much rewrite. *sigh 3) s/kvm_open/kvm_openfiles/; when using kvm_open, kvm_nlist returns "No such file or directory". that fixes this warning. I didn't find much difference umastat output. >How-To-Repeat: >Fix: Patch attached with submission follows: Index: tools/tools/umastat/umastat.c =================================================================== --- tools/tools/umastat/umastat.c (revision 207204) +++ tools/tools/umastat/umastat.c (working copy) @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -196,7 +197,7 @@ LIST_HEAD(bucketlist, uma_bucket); static void -uma_print_bucket(struct uma_bucket *ubp, const char *spaces) +uma_print_bucket(struct uma_bucket *ubp, const char *spaces __unused) { printf("{ ub_cnt = %d, ub_entries = %d }", ubp->ub_cnt, @@ -230,7 +231,7 @@ } printf("\n"); - printf("%s}; // total cnt %llu, total entries %llu\n", spaces, + printf("%s}; // total cnt %ju, total entries %ju\n", spaces, total_cnt, total_entries); } @@ -242,8 +243,8 @@ int ret; printf("%s%s[%d] = {\n", spaces, name, cpu); - printf("%s uc_frees = %llu;\n", spaces, cache->uc_frees); - printf("%s uc_allocs = %llu;\n", spaces, cache->uc_allocs); + printf("%s uc_frees = %ju;\n", spaces, cache->uc_frees); + printf("%s uc_allocs = %ju;\n", spaces, cache->uc_allocs); if (cache->uc_freebucket != NULL) { ret = kread(kvm, cache->uc_freebucket, &ub, sizeof(ub), 0); @@ -286,6 +287,7 @@ size_t uzp_userspace_len; char *memf, *nlistf; int ch; + char errbuf[_POSIX2_LINE_MAX]; memf = nlistf = NULL; while ((ch = getopt(argc, argv, "M:N:")) != -1) { @@ -308,9 +310,9 @@ if (nlistf != NULL && memf == NULL) usage(); - kvm = kvm_open(nlistf, memf, NULL, 0, "umastat"); + kvm = kvm_open(nlistf, memf, NULL, 0, errbuf); if (kvm == NULL) - err(-1, "kvm_open"); + errx(1, "kvm_openfiles: %s", errbuf); if (kvm_nlist(kvm, namelist) != 0) err(-1, "kvm_nlist"); @@ -412,20 +414,20 @@ } printf(" Zone {\n"); printf(" uz_name = \"%s\";\n", name); - printf(" uz_allocs = %llu;\n", + printf(" uz_allocs = %ju;\n", uzp_userspace->uz_allocs); - printf(" uz_frees = %llu;\n", + printf(" uz_frees = %ju;\n", uzp_userspace->uz_frees); - printf(" uz_fails = %llu;\n", + printf(" uz_fails = %ju;\n", uzp_userspace->uz_fails); printf(" uz_fills = %u;\n", uzp_userspace->uz_fills); printf(" uz_count = %u;\n", uzp_userspace->uz_count); - uma_print_bucketlist(kvm, (struct bucketlist *) + uma_print_bucketlist(kvm, (void *) &uzp_userspace->uz_full_bucket, "uz_full_bucket", " "); - uma_print_bucketlist(kvm, (struct bucketlist *) + uma_print_bucketlist(kvm, (void *) &uzp_userspace->uz_free_bucket, "uz_free_bucket", " "); >Release-Note: >Audit-Trail: >Unformatted: