Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Dec 2018 15:23:34 -0800
From:      John Baldwin <jhb@FreeBSD.org>
To:        Warner Losh <imp@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r341657 - in head: etc/mtree sbin/nvmecontrol share/man/man7
Message-ID:  <0b90e8e4-ce69-9caf-21f2-bb76bdfd2635@FreeBSD.org>
In-Reply-To: <201812062258.wB6MwQKb026274@repo.freebsd.org>
References:  <201812062258.wB6MwQKb026274@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 12/6/18 2:58 PM, Warner Losh wrote:
> Author: imp
> Date: Thu Dec  6 22:58:26 2018
> New Revision: 341657
> URL: https://svnweb.freebsd.org/changeset/base/341657
> 
> Log:
>   Dynamically load .so modules to expand functionality
>   
>   o Dynamically load all the .so files found in /libexec/nvmecontrol and
>     /usr/local/libexec/nvmecontrol.
>   o Link nvmecontrol -rdynamic so that its symbols are visible to the
>     libraries we load.
>   o Create concatinated linker sets that we dynamically expand.
>   o Add the linked-in top and logpage linker sets to the mirrors for them
>     and add those sets to the mirrors when we load a new .so.
>   o Add some macros to help hide the names of the linker sets.
>   o Update the man page.
>   
>   Sponsored by: Netflix
>   Differential Revision: https://reviews.freebsd.org/D18455

While linker sets are cool and all (and I used them in mfiutil and mptutil
to build the command tree), it seems like in this case where you want to deal
with dynamic registration, etc. you would be better served by just using
something like STL C++ containers to maintain the command tree.  New
commands can be associated with a static object whose constructor invokes a
"register_command" function or some such.  You could also do this in C via
explicit ctor attributes, but just using static constructors in C++ seems like
a less obscure way to do this.

-- 
John Baldwin

                                                                            



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0b90e8e4-ce69-9caf-21f2-bb76bdfd2635>