[Midnightbsd-cvs] src [11127] sync kldstat with freebsd.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Tue Jun 19 15:38:17 EDT 2018
Revision: 11127
http://svnweb.midnightbsd.org/src/?rev=11127
Author: laffer1
Date: 2018-06-19 15:38:16 -0400 (Tue, 19 Jun 2018)
Log Message:
-----------
sync kldstat with freebsd.
Modified Paths:
--------------
trunk/sbin/kldstat/kldstat.8
trunk/sbin/kldstat/kldstat.c
Property Changed:
----------------
trunk/sbin/kldstat/kldstat.8
Modified: trunk/sbin/kldstat/kldstat.8
===================================================================
--- trunk/sbin/kldstat/kldstat.8 2018-06-19 19:37:30 UTC (rev 11126)
+++ trunk/sbin/kldstat/kldstat.8 2018-06-19 19:38:16 UTC (rev 11127)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\"
.\" Copyright (c) 1997 Doug Rabson
.\" All rights reserved.
@@ -23,9 +24,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/sbin/kldstat/kldstat.8 307403 2016-10-16 22:02:50Z sevan $
.\"
-.Dd September 23, 2005
+.Dd January 22, 2014
.Dt KLDSTAT 8
.Os
.Sh NAME
@@ -33,11 +34,14 @@
.Nd display status of dynamic kernel linker
.Sh SYNOPSIS
.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
@@ -49,6 +53,8 @@
.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
@@ -73,4 +79,4 @@
.Nm lkm
interface.
.Sh AUTHORS
-.An Doug Rabson Aq dfr at FreeBSD.org
+.An Doug Rabson Aq Mt dfr at FreeBSD.org
Property changes on: trunk/sbin/kldstat/kldstat.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sbin/kldstat/kldstat.c
===================================================================
--- trunk/sbin/kldstat/kldstat.c 2018-06-19 19:37:30 UTC (rev 11126)
+++ trunk/sbin/kldstat/kldstat.c 2018-06-19 19:38:16 UTC (rev 11127)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997 Doug Rabson
* All rights reserved.
@@ -25,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sbin/kldstat/kldstat.c 302800 2016-07-14 04:30:42Z julian $");
#include <err.h>
#include <stdio.h>
@@ -35,19 +36,28 @@
#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 +88,8 @@
static void
usage(void)
{
- fprintf(stderr, "usage: kldstat [-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 +104,11 @@
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 +151,14 @@
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;
@@ -146,8 +165,13 @@
}
if (filename != NULL) {
- if ((fileid = kldfind(filename)) < 0)
- err(1, "can't find file %s", filename);
+ if ((fileid = kldfind(filename)) < 0) {
+ if (!quiet)
+ warn("can't find file %s", filename);
+ return 1;
+ } else if (quiet) {
+ return 0;
+ }
}
printf("Id Refs Address%*c Size Name\n", POINTER_WIDTH - 7, ' ');
More information about the Midnightbsd-cvs
mailing list