Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/modstat print flags symbolically.



details:   https://anonhg.NetBSD.org/src/rev/fc15436d6838
branches:  trunk
changeset: 341399:fc15436d6838
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Nov 04 16:04:55 2015 +0000

description:
print flags symbolically.

diffstat:

 sbin/modstat/main.c    |  17 +++++++++++------
 sbin/modstat/modstat.8 |  19 +++++++++++++------
 2 files changed, 24 insertions(+), 12 deletions(-)

diffs (85 lines):

diff -r aa559cd54444 -r fc15436d6838 sbin/modstat/main.c
--- a/sbin/modstat/main.c       Wed Nov 04 15:01:56 2015 +0000
+++ b/sbin/modstat/main.c       Wed Nov 04 16:04:55 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.19 2015/11/04 04:30:42 pgoyette Exp $       */
+/*     $NetBSD: main.c,v 1.20 2015/11/04 16:04:55 christos Exp $       */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.19 2015/11/04 04:30:42 pgoyette Exp $");
+__RCSID("$NetBSD: main.c,v 1.20 2015/11/04 16:04:55 christos Exp $");
 #endif /* !lint */
 
 #include <sys/module.h>
@@ -65,6 +65,10 @@
 };
 const unsigned int source_max = __arraycount(sources);
 
+static const char *modflags[] = {
+       "-", "f", "a", "af"
+};
+
 int
 main(int argc, char **argv)
 {
@@ -175,8 +179,8 @@
                if (maxnamelen < namelen)
                        maxnamelen = namelen;
        }
-       printf("%-*s %-8s %-8s %-6s %-5s %-16s %-7s %s \n",
-           (int)maxnamelen, "NAME", "CLASS", "SOURCE", "FLAGS", "REFS",
+       printf("%-*s %-8s %-8s %-4s %-5s %-16s %-7s %s \n",
+           (int)maxnamelen, "NAME", "CLASS", "SOURCE", "FLAG", "REFS",
            "ADDRESS", "SIZE", "REQUIRES");
        for (ms = iov.iov_base; len != 0; ms++, len--) {
                const char *class;
@@ -204,8 +208,9 @@
                else
                        source = "UNKNOWN";
 
-               printf("%-*s %-8s %-8s 0x%-4x %-5d %-16" PRIx64 " %-7s %s\n",
-                   (int)maxnamelen, ms->ms_name, class, source, ms->ms_flags,
+               printf("%-*s %-8s %-8s %-4s %-5d %-16" PRIx64 " %-7s %s\n",
+                   (int)maxnamelen, ms->ms_name, class, source, 
+                   modflags[ms->ms_flags & (__arraycount(modflags) - 1)],
                    ms->ms_refcnt, ms->ms_addr, sbuf, ms->ms_required);
        }
 
diff -r aa559cd54444 -r fc15436d6838 sbin/modstat/modstat.8
--- a/sbin/modstat/modstat.8    Wed Nov 04 15:01:56 2015 +0000
+++ b/sbin/modstat/modstat.8    Wed Nov 04 16:04:55 2015 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: modstat.8,v 1.16 2015/11/04 04:30:42 pgoyette Exp $
+.\" $NetBSD: modstat.8,v 1.17 2015/11/04 16:04:55 christos Exp $
 .\"
 .\" Copyright (c) 1993 Christopher G. Demetriou
 .\" All rights reserved.
@@ -89,11 +89,18 @@
 indicates that the module was loaded from the file system.
 .It Li SIZE
 Size of the module in bytes.
-.It Li FLAGS
-The module's flags.
-See
-.Xr modctl 2
-for details.
+.It Li FLAG
+The module flags:
+.Bl -tag -width a -offset indent -compact
+.It Dv a
+Module is auto-loaded.
+.It Dv f
+Required the
+.Xr modctl 8
+flag
+.Fl f
+(force) to be loaded.
+.El
 .It Li REFS
 Number of references held on the module.
 Disabled builtin modules will show a count of \-1 here.



Home | Main Index | Thread Index | Old Index