From dan@obluda.cz  Sun Sep 12 17:35:21 2004
Return-Path: <dan@obluda.cz>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1F10116A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 17:35:21 +0000 (GMT)
Received: from kulesh.obluda.cz (kulesh.obluda.cz [193.179.22.243])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A807B43D48
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 17:35:19 +0000 (GMT)
	(envelope-from dan@obluda.cz)
Received: from kulesh.obluda.cz (localhost.eunet.cz [127.0.0.1])
	by kulesh.obluda.cz (8.13.1/8.13.1) with ESMTP id i8CHYlTv010899
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 19:34:48 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Received: (from root@localhost)
	by kulesh.obluda.cz (8.13.1/8.13.1/Submit) id i8CHYfJu010898
	for FreeBSD-gnats-submit@freebsd.org; Sun, 12 Sep 2004 19:34:41 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Message-Id: <200409121734.i8CHYfJu010898@kulesh.obluda.cz>
Date: Sun, 12 Sep 2004 19:34:41 +0200 (CEST)
From: Dan Lukes <dan@obluda.cz>
Reply-To: Dan Lukes <dan@obluda.cz>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] cleanup of the usr.sbin/kgmon code
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         71660
>Category:       bin
>Synopsis:       [patch] cleanup of the usr.sbin/kgmon code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 12 17:40:23 GMT 2004
>Closed-Date:    Sun Jan 03 15:16:06 UTC 2010
>Last-Modified:  Sun Jan 03 15:16:06 UTC 2010
>Originator:     Dan Lukes
>Release:        FreeBSD 5.3-BETA3 i386
>Organization:
Obludarium
>Environment:
System: FreeBSD kulesh.obluda.cz 5.3-BETA3 FreeBSD 5.3-BETA3 #8: Sun Sep 5 07:06:40 CEST 2004 dan@kulesh.obluda.cz:/usr/obj/usr/src/sys/Dan i386
usr.sbin/kgmon/kgmon.c,v 1.13 2004/08/07 04:27:50 imp

>Description:
	There are more than 5000 warnings issued during "make buildworld".
Some of them are false positives, but some of them are sign of true errors.

	Nobody is upset by warnings due it's amount, so some errors remain
uncorrected.

	I want to cleanup the code-base from warnings, so warnings will
become "attention mark" again.

usr.sbin/kgmon/kgmon.c:398: warning: unsigned int format, u_long arg (arg 3)
usr.sbin/kgmon/kgmon.c:420: warning: unsigned int format, u_long arg (arg 3)
usr.sbin/kgmon/kgmon.c:435: warning: unsigned int format, u_long arg (arg 3)
usr.sbin/kgmon/kgmon.c:438: warning: unsigned int format, u_long arg (arg 3)
usr.sbin/kgmon/kgmon.c:450: warning: unsigned int format, u_long arg (arg 2)
usr.sbin/kgmon/kgmon.c:450: warning: unsigned int format, u_long arg (arg 3)
usr.sbin/kgmon/kgmon.c:450: warning: int format, long int arg (arg 4)

>How-To-Repeat:
	N/A
>Fix:
*** usr.sbin/kgmon/kgmon.c.ORIG	Sun Aug  8 21:13:23 2004
--- usr.sbin/kgmon/kgmon.c	Sun Sep 12 05:05:59 2004
***************
*** 393,399 ****
  			i = 0;
  	}
  	if (i != kvp->gpm.kcountsize)
! 		errx(6, "read ticks: read %u, got %d: %s",
  		    kvp->gpm.kcountsize, i,
  		    kflag ? kvm_geterr(kvp->kd) : strerror(errno));
  	if ((fwrite(tickbuf, kvp->gpm.kcountsize, 1, fp)) != 1)
--- 393,399 ----
  			i = 0;
  	}
  	if (i != kvp->gpm.kcountsize)
! 		errx(6, "read ticks: read %lu, got %d: %s",
  		    kvp->gpm.kcountsize, i,
  		    kflag ? kvm_geterr(kvp->kd) : strerror(errno));
  	if ((fwrite(tickbuf, kvp->gpm.kcountsize, 1, fp)) != 1)
***************
*** 415,421 ****
  			i = 0;
  	}
  	if (i != kvp->gpm.fromssize)
! 		errx(9, "read froms: read %u, got %d: %s",
  		    kvp->gpm.fromssize, i,
  		    kflag ? kvm_geterr(kvp->kd) : strerror(errno));
  	if ((tos = (struct tostruct *)malloc(kvp->gpm.tossize)) == NULL)
--- 415,421 ----
  			i = 0;
  	}
  	if (i != kvp->gpm.fromssize)
! 		errx(9, "read froms: read %lu, got %d: %s",
  		    kvp->gpm.fromssize, i,
  		    kflag ? kvm_geterr(kvp->kd) : strerror(errno));
  	if ((tos = (struct tostruct *)malloc(kvp->gpm.tossize)) == NULL)
***************
*** 430,440 ****
  			i = 0;
  	}
  	if (i != kvp->gpm.tossize)
! 		errx(11, "read tos: read %u, got %d: %s",
  		    kvp->gpm.tossize, i,
  		    kflag ? kvm_geterr(kvp->kd) : strerror(errno));
  	if (debug)
! 		warnx("lowpc 0x%x, textsize 0x%x",
  			      kvp->gpm.lowpc, kvp->gpm.textsize);
  	endfrom = kvp->gpm.fromssize / sizeof(*froms);
  	for (fromindex = 0; fromindex < endfrom; ++fromindex) {
--- 430,440 ----
  			i = 0;
  	}
  	if (i != kvp->gpm.tossize)
! 		errx(11, "read tos: read %lu, got %d: %s",
  		    kvp->gpm.tossize, i,
  		    kflag ? kvm_geterr(kvp->kd) : strerror(errno));
  	if (debug)
! 		warnx("lowpc 0x%x, textsize 0x%lx",
  			      kvp->gpm.lowpc, kvp->gpm.textsize);
  	endfrom = kvp->gpm.fromssize / sizeof(*froms);
  	for (fromindex = 0; fromindex < endfrom; ++fromindex) {
***************
*** 445,451 ****
  		for (toindex = froms[fromindex]; toindex != 0;
  		   toindex = tos[toindex].link) {
  			if (debug)
! 			    warnx("[mcleanup] frompc 0x%x selfpc 0x%x count %d",
  			    frompc, tos[toindex].selfpc,
  			    tos[toindex].count);
  			rawarc.raw_frompc = frompc;
--- 445,451 ----
  		for (toindex = froms[fromindex]; toindex != 0;
  		   toindex = tos[toindex].link) {
  			if (debug)
! 			    warnx("[mcleanup] frompc 0x%lx selfpc 0x%lx count %ld",
  			    frompc, tos[toindex].selfpc,
  			    tos[toindex].count);
  			rawarc.raw_frompc = frompc;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: gavin 
State-Changed-When: Sun Jan 3 15:15:07 UTC 2010 
State-Changed-Why:  
These were fixed in kgmon.c 1.14.  Thanks for your submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71660 
>Unformatted:
