summaryrefslogtreecommitdiff
path: root/sbin/kldstat
diff options
context:
space:
mode:
authorGlen Barber <gjb@FreeBSD.org>2016-04-04 23:55:32 +0000
committerGlen Barber <gjb@FreeBSD.org>2016-04-04 23:55:32 +0000
commitd60840138f6292c1ceeb177ebe797eca0b2749da (patch)
treea027fe5a27446f32854d6a07b34b5f2a992bf283 /sbin/kldstat
parentb0b644948c7ed5773b80b8060bb08cb39c024ef5 (diff)
parent8e8df7d50ad7f2b0bb1cb0b8c18242ca511635c3 (diff)
downloadsrc-test-d60840138f6292c1ceeb177ebe797eca0b2749da.tar.gz
src-test-d60840138f6292c1ceeb177ebe797eca0b2749da.zip
Notes
Diffstat (limited to 'sbin/kldstat')
-rw-r--r--sbin/kldstat/Makefile.depend1
-rw-r--r--sbin/kldstat/kldstat.84
-rw-r--r--sbin/kldstat/kldstat.c30
3 files changed, 29 insertions, 6 deletions
diff --git a/sbin/kldstat/Makefile.depend b/sbin/kldstat/Makefile.depend
index 0f77a15a871ff..58f9a3347b00a 100644
--- a/sbin/kldstat/Makefile.depend
+++ b/sbin/kldstat/Makefile.depend
@@ -5,6 +5,7 @@ DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
+ include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
diff --git a/sbin/kldstat/kldstat.8 b/sbin/kldstat/kldstat.8
index 2ea9ca44d4bc1..00918265e3f8d 100644
--- a/sbin/kldstat/kldstat.8
+++ b/sbin/kldstat/kldstat.8
@@ -36,10 +36,12 @@
.Op Fl h
.Op Fl q
.Op Fl v
+.Op Fl d
.Op Fl i Ar id
.Op Fl n Ar filename
.Nm
.Op Fl q
+.Op Fl d
.Op Fl m Ar modname
.Sh DESCRIPTION
The
@@ -54,6 +56,8 @@ Display the size field in a human-readable form, using unit suffixes
instead of hex values.
.It Fl v
Be more verbose.
+.It Fl d
+Show the module specific data (as int, unsigned int and unsigned long)
.It Fl i Ar id
Display the status of only the file with this ID.
.It Fl n Ar filename
diff --git a/sbin/kldstat/kldstat.c b/sbin/kldstat/kldstat.c
index c48024f0d43bf..3ae75183b5709 100644
--- a/sbin/kldstat/kldstat.c
+++ b/sbin/kldstat/kldstat.c
@@ -36,19 +36,28 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/module.h>
#include <sys/linker.h>
+#include <strings.h>
#define POINTER_WIDTH ((int)(sizeof(void *) * 2 + 2))
+static int showdata = 0;
+
static void
printmod(int modid)
{
struct module_stat stat;
+ bzero(&stat, sizeof(stat));
stat.version = sizeof(struct module_stat);
if (modstat(modid, &stat) < 0)
warn("can't stat module id %d", modid);
else
- printf("\t\t%2d %s\n", stat.id, stat.name);
+ if (showdata) {
+ printf("\t\t%2d %s (%d, %u, 0x%lx)\n", stat.id, stat.name,
+ stat.data.intval, stat.data.uintval, stat.data.ulongval);
+ } else {
+ printf("\t\t%2d %s\n", stat.id, stat.name);
+ }
}
static void
@@ -88,8 +97,8 @@ printfile(int fileid, int verbose, int humanized)
static void
usage(void)
{
- fprintf(stderr, "usage: kldstat [-h] [-q] [-v] [-i id] [-n filename]\n");
- fprintf(stderr, " kldstat [-q] [-m modname]\n");
+ fprintf(stderr, "usage: kldstata[-d] [-h] [-q] [-v] [-i id] [-n filename]\n");
+ fprintf(stderr, " kldstat [-d] [-q] [-m modname]\n");
exit(1);
}
@@ -105,8 +114,11 @@ main(int argc, char** argv)
char* modname = NULL;
char* p;
- while ((c = getopt(argc, argv, "hi:m:n:qv")) != -1)
+ while ((c = getopt(argc, argv, "dhi:m:n:qv")) != -1)
switch (c) {
+ case 'd':
+ showdata = 1;
+ break;
case 'h':
humanized = 1;
break;
@@ -152,8 +164,14 @@ main(int argc, char** argv)
if (modstat(modid, &stat) < 0)
warn("can't stat module id %d", modid);
else {
- printf("Id Refs Name\n");
- printf("%3d %4d %s\n", stat.id, stat.refs, stat.name);
+ if (showdata) {
+ printf("Id Refs Name data..(int, uint, ulong)\n");
+ printf("%3d %4d %s (%d, %u, 0x%lx)\n", stat.id, stat.refs, stat.name,
+ stat.data.intval, stat.data.uintval, stat.data.ulongval);
+ } else {
+ printf("Id Refs Name\n");
+ printf("%3d %4d %s\n", stat.id, stat.refs, stat.name);
+ }
}
return 0;