Global variables in system programs

Eitan Adler lists at eitanadler.com
Thu Oct 17 01:45:52 UTC 2013


On Tue, Oct 15, 2013 at 11:07 AM, Sebastian Huber
<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.

Are patches acceptable for the FreeBSD project that alter
> system programs such that


> o global variables are moved into context structures,

Provided that the code remains readable I think these would be fine.

> o constant global variables are declared as "const", and
> o variables and functions are declared as "static" if possible?

There has been a lot of work on this area.  Your patch surprises me
because I see many changes which were already done.  We would
absolutely be interested in such patches

> Attached is a patch for the ROUTE(8) program to give an example.

This patch can not apply for instance

patchfile:
 960
 961 -char metricnames[] =
 962 +static const char metricnames[] =
 963  "\011weight\010rttvar\7rtt\6ssthresh\5sendpipe\4recvpipe\3expire"
 964  "\1mtu";

but actual file:

1557 static const char metricnames[] =
1558     "\011weight\010rttvar\7rtt\6ssthresh\5sendpipe\4recvpipe\3expire"
1559     "\1mtu";


If you can generate patches against HEAD that would be great.

I notice you use git: try to generate patches against
https://github.com/freebsd/freebsd


-- 
Eitan Adler


More information about the freebsd-hackers mailing list