a few minor kldstat fixes

Alexander Best arundel at freebsd.org
Thu Oct 21 17:46:58 UTC 2010


this patch fixes the following issues:

- unbreak 'kldstat -i 999 -v' output
- remove an unnecessary set of "{" and "}"
- change printfile() to blend into the overall style used in kldstat.c
- add a kldstat(8) entry to document the relationship between the "-i" and "-n" flags

cheers.
alex

-- 
a13x
-------------- next part --------------
diff --git a/sbin/kldstat/kldstat.8 b/sbin/kldstat/kldstat.8
index 6f040e2..313a5c6 100644
--- a/sbin/kldstat/kldstat.8
+++ b/sbin/kldstat/kldstat.8
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 23, 2005
+.Dd October 21, 2010
 .Dt KLDSTAT 8
 .Os
 .Sh NAME
@@ -52,7 +52,10 @@ Be more verbose.
 .It Fl i Ar id
 Display the status of only the file with this ID.
 .It Fl n Ar filename
-Display the status of only the file with this filename.
+Display the status of only the file with this filename. This will overwrite any
+previous
+.Fl i
+option.
 .It Fl q
 Only check if module is loaded or compiled into the kernel.
 .It Fl m Ar modname
diff --git a/sbin/kldstat/kldstat.c b/sbin/kldstat/kldstat.c
index 78182b9..f671c60 100644
--- a/sbin/kldstat/kldstat.c
+++ b/sbin/kldstat/kldstat.c
@@ -50,14 +50,15 @@ printmod(int modid)
 	printf("\t\t%2d %s\n", stat.id, stat.name);
 }
 
-static void printfile(int fileid, int verbose)
+static void
+printfile(int fileid, int verbose)
 {
     struct kld_file_stat stat;
     int modid;
 
     stat.version = sizeof(struct kld_file_stat);
     if (kldstat(fileid, &stat) < 0)
-	warn("can't stat file id %d", fileid);
+	err(1, "can't stat file id %d", fileid);
     else
 	printf("%2d %4d %p %-8zx %s",
 	       stat.id, stat.refs, stat.address, stat.size, 
@@ -144,10 +145,9 @@ main(int argc, char** argv)
 	return 0;
     }
 
-    if (filename != NULL) {
+    if (filename != NULL)
 	if ((fileid = kldfind(filename)) < 0)
 	    err(1, "can't find file %s", filename);
-    }
 
     printf("Id Refs Address%*c Size     Name\n", POINTER_WIDTH - 7, ' ');
     if (fileid != 0)


More information about the freebsd-hackers mailing list