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

2019-02-01 Thread Aaron LI
Quoting Sepherosa Ziehau (2019-02-01 22:21:28)
> On Fri, Feb 1, 2019 at 9:59 PM Aaron LI  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=6
> 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 -> 6
> 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
> 6
> net.inet.ip.portrange.last: 6 -> 6
> 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


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

2019-02-01 Thread Sepherosa Ziehau
On Fri, Feb 1, 2019 at 9:59 PM Aaron LI  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=6
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 -> 6
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
6
net.inet.ip.portrange.last: 6 -> 6
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)

login:



Thanks,
sephe



-- 
Tomorrow Will Never Die


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

2019-02-01 Thread Aaron LI
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.

Aaron

PS. I'll look into the issues when I get home on Feb 3.


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

2019-02-01 Thread Sepherosa Ziehau
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.

Thanks,
sephe

On Thu, Dec 20, 2018 at 10:28 AM Aaron LI  wrote:
>
>
> commit 87206e7c403a8c39917ab3389bb5c3259b68b501
> Author: Aaron LI 
> Date:   Thu Dec 13 13:58:27 2018 +0800
>
> rc.d/sysctl: Rewrite to be more robust and clean
>
> * Check the validity of the sysctl config and warn about the invalid
>   syntax.
>
>   A common mistake is that users set 'sysctl =' in
>   /etc/sysctl.conf, which generate huge amount of junk/mysterious
>   messages on the console.  Now this will be warned.
>
> * Reorganize the logic to be much cleaner.
>
> * Do not bother to check whether the new value is different from the old
>   one.
>
> * Rename the function for consistency.
>
> Summary of changes:
>  etc/rc.d/sysctl | 65 
> +
>  1 file changed, 33 insertions(+), 32 deletions(-)
>
> http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/87206e7c403a8c39917ab3389bb5c3259b68b501
>
>
> --
> DragonFly BSD source repository



-- 
Tomorrow Will Never Die