From owner-svn-src-stable@freebsd.org Thu Jul 14 04:30:44 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31639B9884B; Thu, 14 Jul 2016 04:30:44 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D4931F08; Thu, 14 Jul 2016 04:30:43 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6E4UhGQ017423; Thu, 14 Jul 2016 04:30:43 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6E4Uhxc017421; Thu, 14 Jul 2016 04:30:43 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201607140430.u6E4Uhxc017421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Thu, 14 Jul 2016 04:30:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r302800 - stable/10/sbin/kldstat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 04:30:44 -0000 Author: julian Date: Thu Jul 14 04:30:42 2016 New Revision: 302800 URL: https://svnweb.freebsd.org/changeset/base/302800 Log: MFH: r297023 Add the ability to print out the module specific information in likely formats. Among other things this gives us the ability to find out the syscall number of a dynamically loaded syscall that has a dynamicly allocated vector number. Sponsored by: Panzura inc. Modified: stable/10/sbin/kldstat/kldstat.8 stable/10/sbin/kldstat/kldstat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/kldstat/kldstat.8 ============================================================================== --- stable/10/sbin/kldstat/kldstat.8 Thu Jul 14 02:25:29 2016 (r302799) +++ stable/10/sbin/kldstat/kldstat.8 Thu Jul 14 04:30:42 2016 (r302800) @@ -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 Modified: stable/10/sbin/kldstat/kldstat.c ============================================================================== --- stable/10/sbin/kldstat/kldstat.c Thu Jul 14 02:25:29 2016 (r302799) +++ stable/10/sbin/kldstat/kldstat.c Thu Jul 14 04:30:42 2016 (r302800) @@ -35,19 +35,28 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #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;