Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jun 2016 06:08:32 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        "Conrad E. Meyer" <cem@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r301751 - head/sys/kern
Message-ID:  <20160610030832.GC38613@kib.kiev.ua>
In-Reply-To: <201606091827.u59IRfD1090422@repo.freebsd.org>
References:  <201606091827.u59IRfD1090422@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 09, 2016 at 06:27:41PM +0000, Conrad E. Meyer wrote:
> Author: cem
> Date: Thu Jun  9 18:27:41 2016
> New Revision: 301751
> URL: https://svnweb.freebsd.org/changeset/base/301751
> 
> Log:
>   Add DDB command "kldstat"
>   
>   It prints much the same information as kldstat(8) without any arguments.
>   
>   Suggested by:	jhibbits
>   Sponsored by:	EMC / Isilon Storage Division
> 
> Modified:
>   head/sys/kern/kern_linker.c
> 
> Modified: head/sys/kern/kern_linker.c
> ==============================================================================
> --- head/sys/kern/kern_linker.c	Thu Jun  9 18:24:51 2016	(r301750)
> +++ head/sys/kern/kern_linker.c	Thu Jun  9 18:27:41 2016	(r301751)
> @@ -54,6 +54,10 @@ __FBSDID("$FreeBSD$");
>  #include <sys/syscallsubr.h>
>  #include <sys/sysctl.h>
>  
> +#ifdef DDB
> +#include <ddb/ddb.h>
> +#endif
> +
>  #include <net/vnet.h>
>  
>  #include <security/mac/mac_framework.h>
> @@ -1256,6 +1260,23 @@ kern_kldstat(struct thread *td, int file
>  	return (0);
>  }
>  
> +#ifdef DDB
> +DB_COMMAND(kldstat, db_kldstat)
This would arguably more visible if done as the 'show klds' or similar
subcommand. The first place where people accustomed to ddb look when
want to see some kernel structures dumped, is 'show'.

BTW, a useful tradition is to have 'show kld <addr>' and 'show klds'
commands. If not clear from the structure, the first command would print
the information about single linker file at the given address (whatever
it is), and second does what your current 'kldstat' offer.


> +{
> +	linker_file_t lf;
> +
> +#define	POINTER_WIDTH	((int)(sizeof(void *) * 2 + 2))
> +	db_printf("Id Refs Address%*c Size     Name\n", POINTER_WIDTH - 7, ' ');
> +#undef	POINTER_WIDTH
> +	TAILQ_FOREACH(lf, &linker_files, link) {
> +		if (db_pager_quit)
> +			return;
> +		db_printf("%2d %4d %p %-8zx %s\n", lf->id, lf->refs,
> +		    lf->address, lf->size, lf->filename);
> +	}
> +}
> +#endif /* DDB */
> +
>  int
>  sys_kldfirstmod(struct thread *td, struct kldfirstmod_args *uap)
>  {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160610030832.GC38613>