summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/kldstat/kldstat.84
-rw-r--r--sbin/kldstat/kldstat.c30
-rw-r--r--sbin/sysctl/sysctl.c18
3 files changed, 37 insertions, 15 deletions
diff --git a/sbin/kldstat/kldstat.8 b/sbin/kldstat/kldstat.8
index bebabe8..63f07a6 100644
--- a/sbin/kldstat/kldstat.8
+++ b/sbin/kldstat/kldstat.8
@@ -35,10 +35,12 @@
.Nm
.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
@@ -50,6 +52,8 @@ The following options are available:
.Bl -tag -width indentXX
.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 8785c00..9e41d43 100644
--- a/sbin/kldstat/kldstat.c
+++ b/sbin/kldstat/kldstat.c
@@ -35,19 +35,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
@@ -78,8 +87,8 @@ printfile(int fileid, int verbose)
static void
usage(void)
{
- fprintf(stderr, "usage: kldstat [-q] [-v] [-i id] [-n filename]\n");
- fprintf(stderr, " kldstat [-q] [-m modname]\n");
+ fprintf(stderr, "usage: kldstat [-d] [-q] [-v] [-i id] [-n filename]\n");
+ fprintf(stderr, " kldstat [-d] [-q] [-m modname]\n");
exit(1);
}
@@ -94,8 +103,11 @@ main(int argc, char** argv)
char* modname = NULL;
char* p;
- while ((c = getopt(argc, argv, "i:m:n:qv")) != -1)
+ while ((c = getopt(argc, argv, "di:m:n:qv")) != -1)
switch (c) {
+ case 'd':
+ showdata = 1;
+ break;
case 'i':
fileid = (int)strtoul(optarg, &p, 10);
if (*p != '\0')
@@ -138,8 +150,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;
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index c0bcc81..9f5811c 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -547,15 +547,15 @@ S_vmtotal(size_t l2, void *p)
"%hd Sleep: %hd)\n",
v->t_rq, v->t_dw, v->t_pw, v->t_sl);
printf(
- "Virtual Memory:\t\t(Total: %dK Active: %dK)\n",
- v->t_vm * pageKilo, v->t_avm * pageKilo);
- printf("Real Memory:\t\t(Total: %dK Active: %dK)\n",
- v->t_rm * pageKilo, v->t_arm * pageKilo);
- printf("Shared Virtual Memory:\t(Total: %dK Active: %dK)\n",
- v->t_vmshr * pageKilo, v->t_avmshr * pageKilo);
- printf("Shared Real Memory:\t(Total: %dK Active: %dK)\n",
- v->t_rmshr * pageKilo, v->t_armshr * pageKilo);
- printf("Free Memory:\t%dK", v->t_free * pageKilo);
+ "Virtual Memory:\t\t(Total: %jdK Active: %jdK)\n",
+ (intmax_t)v->t_vm * pageKilo, (intmax_t)v->t_avm * pageKilo);
+ printf("Real Memory:\t\t(Total: %jdK Active: %jdK)\n",
+ (intmax_t)v->t_rm * pageKilo, (intmax_t)v->t_arm * pageKilo);
+ printf("Shared Virtual Memory:\t(Total: %jdK Active: %jdK)\n",
+ (intmax_t)v->t_vmshr * pageKilo, (intmax_t)v->t_avmshr * pageKilo);
+ printf("Shared Real Memory:\t(Total: %jdK Active: %jdK)\n",
+ (intmax_t)v->t_rmshr * pageKilo, (intmax_t)v->t_armshr * pageKilo);
+ printf("Free Memory:\t%jdK", (intmax_t)v->t_free * pageKilo);
return (0);
}
OpenPOWER on IntegriCloud