bin/180014: Patch for kldstat: add quiet option to filename mode

Olivier Cochard-Labbé olivier at cochard.me
Wed Jun 26 22:50:00 UTC 2013


>Number:         180014
>Category:       bin
>Synopsis:       Patch for kldstat: add quiet option to filename mode
>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:   Wed Jun 26 22:50:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Olivier Cochard-Labbé
>Release:        current
>Organization:
BSD Router Project
>Environment:
FreeBSD orange.bsdrp.net 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r252056M: Fri Jun 21 17:24:08 CEST 2013     root at orange.bsdrp.net:/usr/obj/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/PROD  amd64

>Description:
kldstat have a quiet (-q) option, but it's supported only for modulname (-m) and not for filename (-n).
This patch add quiet option for filename too.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- kldstat.c.orig	2013-06-27 00:19:44.339868707 +0200
+++ kldstat.c	2013-06-27 00:34:52.730802738 +0200
@@ -78,7 +78,7 @@
 static void
 usage(void)
 {
-    fprintf(stderr, "usage: kldstat [-v] [-i id] [-n filename]\n");
+    fprintf(stderr, "usage: kldstat [-q] [-v] [-i id] [-n filename]\n");
     fprintf(stderr, "       kldstat [-q] [-m modname]\n");
     exit(1);
 }
@@ -146,8 +146,13 @@
     }
 
     if (filename != NULL) {
-	if ((fileid = kldfind(filename)) < 0)
-	    err(1, "can't find file %s", filename);
+		if ((fileid = kldfind(filename)) < 0) {
+			if (!quiet)
+	    	err(1, "can't find file %s", filename);
+			return 1;
+		} else if (quiet) {
+			return 0;
+		}
     }
 
     printf("Id Refs Address%*c Size     Name\n", POINTER_WIDTH - 7, ' ');


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list