From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 21 17:46:58 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 108B51065673; Thu, 21 Oct 2010 17:46:58 +0000 (UTC) Date: Thu, 21 Oct 2010 17:46:58 +0000 From: Alexander Best To: freebsd-hackers@freebsd.org Message-ID: <20101021174658.GA11107@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="AhhlLboLdkugWU4S" Content-Disposition: inline Subject: a few minor kldstat fixes X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Oct 2010 17:46:58 -0000 --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="kldstat.diff" 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) --AhhlLboLdkugWU4S--