Module Name:    src
Committed By:   pgoyette
Date:           Wed Dec  2 00:56:09 UTC 2015

Modified Files:
        src/sbin/modstat: main.c modstat.8

Log Message:
By default, don't display the module load address.  Add a -k option
to restore display of this field.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sbin/modstat/main.c
cvs rdiff -u -r1.18 -r1.19 src/sbin/modstat/modstat.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/modstat/main.c
diff -u src/sbin/modstat/main.c:1.20 src/sbin/modstat/main.c:1.21
--- src/sbin/modstat/main.c:1.20	Wed Nov  4 16:04:55 2015
+++ src/sbin/modstat/main.c	Wed Dec  2 00:56:09 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.20 2015/11/04 16:04:55 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.21 2015/12/02 00:56:09 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.20 2015/11/04 16:04:55 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.21 2015/12/02 00:56:09 pgoyette Exp $");
 #endif /* !lint */
 
 #include <sys/module.h>
@@ -41,6 +41,7 @@ __RCSID("$NetBSD: main.c,v 1.20 2015/11/
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <stdbool.h>
 
 #include "prog_ops.h"
 
@@ -80,16 +81,20 @@ main(int argc, char **argv)
 	int ch, rc, modauto = 1;
 	size_t maxnamelen = 16, i, modautolen;
 	char loadable = '\0';
+	bool address = false;
 
 	name = NULL;
 
-	while ((ch = getopt(argc, argv, "Aaen:")) != -1) {
+	while ((ch = getopt(argc, argv, "Aaekn:")) != -1) {
 		switch (ch) {
 		case 'A':			/* FALLTHROUGH */
 		case 'a':			/* FALLTHROUGH */
 		case 'e':
 			loadable = (char)ch;
 			break;
+		case 'k':
+			address = true;
+			break;
 		case 'n':
 			name = optarg;
 			break;
@@ -179,9 +184,11 @@ main(int argc, char **argv)
 		if (maxnamelen < namelen)
 			maxnamelen = namelen;
 	}
-	printf("%-*s %-8s %-8s %-4s %-5s %-16s %-7s %s \n",
-	    (int)maxnamelen, "NAME", "CLASS", "SOURCE", "FLAG", "REFS",
-	    "ADDRESS", "SIZE", "REQUIRES");
+	printf("%-*s %-8s %-8s %-4s %-5s ",
+	    (int)maxnamelen, "NAME", "CLASS", "SOURCE", "FLAG", "REFS");
+	if (address)
+		printf("%-16s ", "ADDRESS");
+	printf("%-7s %s \n", "SIZE", "REQUIRES");
 	for (ms = iov.iov_base; len != 0; ms++, len--) {
 		const char *class;
 		const char *source;
@@ -208,10 +215,13 @@ main(int argc, char **argv)
 		else
 			source = "UNKNOWN";
 
-		printf("%-*s %-8s %-8s %-4s %-5d %-16" PRIx64 " %-7s %s\n",
+		printf("%-*s %-8s %-8s %-4s %-5d ",
 		    (int)maxnamelen, ms->ms_name, class, source, 
 		    modflags[ms->ms_flags & (__arraycount(modflags) - 1)],
-		    ms->ms_refcnt, ms->ms_addr, sbuf, ms->ms_required);
+		    ms->ms_refcnt);
+		if (address)
+			printf("%-16" PRIx64 " ", ms->ms_addr);
+		printf("%-7s %s\n", sbuf, ms->ms_required);
 	}
 
 	exit(EXIT_SUCCESS);

Index: src/sbin/modstat/modstat.8
diff -u src/sbin/modstat/modstat.8:1.18 src/sbin/modstat/modstat.8:1.19
--- src/sbin/modstat/modstat.8:1.18	Sun Nov 29 21:36:35 2015
+++ src/sbin/modstat/modstat.8	Wed Dec  2 00:56:09 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: modstat.8,v 1.18 2015/11/29 21:36:35 wiz Exp $
+.\" $NetBSD: modstat.8,v 1.19 2015/12/02 00:56:09 pgoyette Exp $
 .\"
 .\" Copyright (c) 1993 Christopher G. Demetriou
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
 .\"
-.Dd November 4, 2015
+.Dd December 2, 2015
 .Dt MODSTAT 8
 .Os
 .Sh NAME
@@ -63,6 +63,8 @@ take into consideration the sysctl
 .Li kern.module.autoload .
 .It Fl e
 Tells you whether or not you may load a module at the moment.
+.It Fl k
+Display the module's kernel address (disabled by default).
 .It Fl n Ar name
 Display the status of only the module with this name.
 Please note that
@@ -107,6 +109,9 @@ Disabled builtin modules will show a cou
 .It Li ADDRESS
 The kernel address at which the module is loaded.
 Builtin modules will show 0 here.
+This field is only displayed if the
+.Fl k
+option is specified.
 .It Li REQUIRES
 Additional modules that must be present.
 .El

Reply via email to