bin/146046: [kld] [patch] kldstat(8) contains an obsolete cast

Alexander Best alexbestms at
Sun Apr 25 19:30:03 UTC 2010

>Number:         146046
>Category:       bin
>Synopsis:       [kld] [patch] kldstat(8) contains an obsolete cast
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 25 19:30:02 UTC 2010
>Originator:     Alexander Best
>Release:        9.0-CURRENT
FreeBSD otaku 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r207154M: Sat Apr 24 21:14:37 CEST 2010     root at otaku:/usr/obj/usr/src/sys/ARUNDEL  amd64
7 years ago a cast of stat.size to uintmax_t in order to make kldstat.c WARNS=5 clean was introduced [1]. it appears that back then printf(3) couldn't handle size_t. since nowadays printf(3) is able to, make use of it. with the removal of the cast to uintmax_t inclusion of stdint.h is no longer required.

[1] in revision 113933

apply the attached patch.

Patch attached with submission follows:

Index: sbin/kldstat/kldstat.c
--- sbin/kldstat/kldstat.c	(revision 207014)
+++ sbin/kldstat/kldstat.c	(working copy)
@@ -28,7 +28,6 @@
 #include <err.h>
-#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -60,8 +59,8 @@
     if (kldstat(fileid, &stat) < 0)
 	warn("can't stat file id %d", fileid);
-	printf("%2d %4d %p %-8jx %s",
-, stat.refs, stat.address, (uintmax_t)stat.size, 
+	printf("%2d %4d %p %-8zx %s",
+, stat.refs, stat.address, stat.size,;
     if (verbose) {


More information about the freebsd-bugs mailing list