bin/71660: [PATCH] cleanup of the usr.sbin/kgmon code

Dan Lukes dan at obluda.cz
Sun Sep 12 10:40:26 PDT 2004


>Number:         71660
>Category:       bin
>Synopsis:       [PATCH] cleanup of the usr.sbin/kgmon code
>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:   Sun Sep 12 17:40:23 GMT 2004
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list