From owner-svn-src-head@FreeBSD.ORG Fri Sep 12 21:01:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ACE0E671; Fri, 12 Sep 2014 21:01:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D0C08D7; Fri, 12 Sep 2014 21:01:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8CL1dX9060313; Fri, 12 Sep 2014 21:01:39 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8CL1dP9060312; Fri, 12 Sep 2014 21:01:39 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201409122101.s8CL1dP9060312@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Sep 2014 21:01:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271487 - head/sbin/sysctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Sep 2014 21:01:39 -0000 Author: jhb Date: Fri Sep 12 21:01:39 2014 New Revision: 271487 URL: http://svnweb.freebsd.org/changeset/base/271487 Log: Pass the length of an structure to the pretty-printer backends as a size_t instead of an int. Modified: head/sbin/sysctl/sysctl.c Modified: head/sbin/sysctl/sysctl.c ============================================================================== --- head/sbin/sysctl/sysctl.c Fri Sep 12 20:56:09 2014 (r271486) +++ head/sbin/sysctl/sysctl.c Fri Sep 12 21:01:39 2014 (r271487) @@ -458,12 +458,12 @@ parsefile(const char *filename) /* These functions will dump out various interesting structures. */ static int -S_clockinfo(int l2, void *p) +S_clockinfo(size_t l2, void *p) { struct clockinfo *ci = (struct clockinfo*)p; if (l2 != sizeof(*ci)) { - warnx("S_clockinfo %d != %zu", l2, sizeof(*ci)); + warnx("S_clockinfo %zu != %zu", l2, sizeof(*ci)); return (1); } printf(hflag ? "{ hz = %'d, tick = %'d, profhz = %'d, stathz = %'d }" : @@ -473,12 +473,12 @@ S_clockinfo(int l2, void *p) } static int -S_loadavg(int l2, void *p) +S_loadavg(size_t l2, void *p) { struct loadavg *tv = (struct loadavg*)p; if (l2 != sizeof(*tv)) { - warnx("S_loadavg %d != %zu", l2, sizeof(*tv)); + warnx("S_loadavg %zu != %zu", l2, sizeof(*tv)); return (1); } printf(hflag ? "{ %'.2f %'.2f %'.2f }" : "{ %.2f %.2f %.2f }", @@ -489,14 +489,14 @@ S_loadavg(int l2, void *p) } static int -S_timeval(int l2, void *p) +S_timeval(size_t l2, void *p) { struct timeval *tv = (struct timeval*)p; time_t tv_sec; char *p1, *p2; if (l2 != sizeof(*tv)) { - warnx("S_timeval %d != %zu", l2, sizeof(*tv)); + warnx("S_timeval %zu != %zu", l2, sizeof(*tv)); return (1); } printf(hflag ? "{ sec = %'jd, usec = %'ld } " : @@ -513,13 +513,13 @@ S_timeval(int l2, void *p) } static int -S_vmtotal(int l2, void *p) +S_vmtotal(size_t l2, void *p) { struct vmtotal *v = (struct vmtotal *)p; int pageKilo = getpagesize() / 1024; if (l2 != sizeof(*v)) { - warnx("S_vmtotal %d != %zu", l2, sizeof(*v)); + warnx("S_vmtotal %zu != %zu", l2, sizeof(*v)); return (1); } @@ -540,19 +540,19 @@ S_vmtotal(int l2, void *p) v->t_vmshr * pageKilo, v->t_avmshr * pageKilo); printf("Shared Real Memory:\t(Total: %dK Active: %dK)\n", v->t_rmshr * pageKilo, v->t_armshr * pageKilo); - printf("Free Memory:\t%dK\n", v->t_free * pageKilo); + printf("Free Memory:\t%dK", v->t_free * pageKilo); return (0); } #if defined(__amd64__) || defined(__i386__) static int -S_bios_smap_xattr(int l2, void *p) +S_bios_smap_xattr(size_t l2, void *p) { struct bios_smap_xattr *smap, *end; if (l2 % sizeof(*smap) != 0) { - warnx("S_bios_smap_xattr %d is not a multiple of %zu", l2, + warnx("S_bios_smap_xattr %zu is not a multiple of %zu", l2, sizeof(*smap)); return (1); } @@ -680,7 +680,7 @@ show_var(int *oid, int nlen) size_t intlen; size_t j, len; u_int kind; - int (*func)(int, void *); + int (*func)(size_t, void *); /* Silence GCC. */ umv = mv = intlen = 0;