Global variables in system programs

Matthew Fleming mdf at FreeBSD.org
Thu Oct 17 13:44:56 UTC 2013


On Thu, Oct 17, 2013 at 2:09 AM, Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> On 2013-10-17 03:45, Eitan Adler wrote:
>
>> On Tue, Oct 15, 2013 at 11:07 AM, Sebastian Huber
>> <sebastian.huber at embedded-**brains.de<sebastian.huber at embedded-brains.de>>
>> wrote:
>>
>>  These programs use some global variables.  In a statically linked
>>> context we
>>> have now the following problems
>>>
>>
>> This is a pretty awesome idea.  I've seen some work like this but it
>> would be great to get FreeBSD into a state where this is easy.
>>
>
> If it is acceptable for the FreeBSD project to turn e.g. ROUTE(8) and
> IFCONFIG(8) into library functions then this would be great.  I can do the
> work.


At a meta level, IMO *most* of the functionality in binaries should be in
libraries.  How many times writing a C unit test have I wanted to do rm -rf
of the temporary files I created?  But the recursive remove is in rm(1) not
in libutil.  And it sounds like the functionality in route/ifconfig is now
desired to be accessed programatically, not just from a shell script.  So
+1 for moving code into a library where it can be re-used.

Cheers,
matthew


More information about the freebsd-hackers mailing list