git: rc.d/sysctl: Rewrite to be more robust and clean

Aaron LI aly at aaronly.me
Fri Feb 1 06:33:49 PST 2019


Quoting Sepherosa Ziehau (2019-02-01 22:21:28)
> On Fri, Feb 1, 2019 at 9:59 PM Aaron LI <aly at aaronly.me> wrote:
> >
> > Quoting Sepherosa Ziehau (2019-02-01 21:33:18)
> > > Please check fix this commit, there are several unexpected effects of
> > > this commit:
> > > - Extra original value printed on the screen, when this script is run.
> > > Before this change, a=`cmd` will not print anything on the screen.
> > > - It looks after or during "TCP options" sysctl, this script is
> > > invoked again in a quite verbose mode, which does not happen before.
> > >
> >
> > Hi sephe, thanks for pointing out the issues.
> >
> > Could you post your /etc/sysctl.conf so that I can see the exact
> > unexpected behaviors?  Thanks.
> 
> I don't think it's specific to my sysctl.conf, here it is:
> 
> # $FreeBSD: src/etc/sysctl.conf,v 1.1.2.3 2002/04/15 00:44:13 dougb Exp $
> # $DragonFly: src/etc/sysctl.conf,v 1.2 2003/06/17 04:24:45 dillon Exp $
> #
> #  This file is read when going to multi-user and its contents piped thru
> #  ``sysctl'' to adjust kernel values.  ``man 5 sysctl.conf'' for details.
> #
> #debug.debugger_on_panic=0
> 
> kern.syscons_async=0
> 
> machdep.cpu_idle_hlt=1
> #machdep.mwait.CX.repeat_shift=2
> machdep.mwait.CX.idle=AUTODEEP
> 
> kern.ipc.somaxconn=256
> kern.ipc.maxsockbuf=16777216
> 
> net.inet.ip.portrange.last=60000
> net.inet.ip.forwarding=1
> 
> #lwkt.token_spin=96
> 
> ===========  This is what I got on the screen during boot:
> 0
> kern.syscons_async: 0 -> 0
> 1
> machdep.cpu_idlecputimer: first power save request
> _hlt: 1 -> 1
> C1/0
> machdep.mwait.CX.idle: C1/0 -> AUTODEEP
> 128
> kern.ipc.somaxconn: 128 -> 256
> 524288
> kern.ipc.maxsockbuf: 524288 -> 16777216
> 5000
> net.inet.ip.portrange.last: 5000 -> 60000
> 0
> net.inet.ip.forwarding: 0 -> 1
> ...
> ...
> Additional TCP options:.
> 0
> kern.syscons_async: 0 -> 0
> 1
> machdep.cpu_idle_hlt: 1 -> 1
> AUTODEEP
> machdep.mwait.CX.idle: AUTODEEP -> AUTODEEP
> 256
> kern.ipc.somaxconn: 256 -> 256
> 16777216
> kern.ipc.maxsockbuf: 16777216 -> 16777216
> 60000
> net.inet.ip.portrange.last: 60000 -> 60000
> 1
> net.inet.ip.forwarding: 1 -> 1
> 
> Fri Feb  1 21:31:20 CST 2019
> igb0: Link is up 1000 Mbps Full Duplex, Flow control: none
> 
> DragonFly/x86_64 (xanadux) (cuaa1)
> 

sephe, thanks.

I see the major change is due to: "Do not bother to check whether the 
new value is different from the old one."  That is every setting in 
/etc/sysctl.conf will be executed in a verbose way, even though the new 
value is the same.

I'll bring back the original behavior of rc.d/sysctl latter.

Cheers,
Aaron



More information about the Commits mailing list