Thoughts about kenv emulating sysctl

2012-05-09 Thread Garrett Cooper
Hi Hackers,
I've been asked to write up a script to analyze tunables via kenv for 
archival purposes an to establish a baseline set of static variables.
In order to make life easier (and be able to do all the grunt work in a 
shell one-liner instead of introducing a bug prone tunable parser) I have 
written up a patch which would make kenv function a bit more like sysctl, wrt 
the fact that sysctl -n suppresses suffixing a value with the variable name 
when executed like so:

# kenv LINES
LINES=24
# kenv -n LINES
24

I've also considered keeping the functional defaults and instead do the 
following...

# kenv -v LINES
LINES=24
# kenv LINES
24

Pro of the first form is that it matches sysctl, pro of the second form is 
that it doesn't break backwards 'compatibility'.
I know kenv isn't a widely used utility (albeit, I have seen it used in a 
few spots outside of FreeBSD proper), but I was wondering if anyone could see 
any potential pitfalls or would have a large degree of heartburn over changing 
the default to match sysctl.
Thanks!
-Garrett___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Thoughts about kenv emulating sysctl

2012-05-09 Thread Aleksandr Rybalko
On Wed, 9 May 2012 09:05:47 -0700
Garrett Cooper yaneg...@gmail.com wrote:

 Hi Hackers,
 I've been asked to write up a script to analyze tunables via kenv
 for archival purposes an to establish a baseline set of static
 variables. In order to make life easier (and be able to do all the
 grunt work in a shell one-liner instead of introducing a bug prone
 tunable parser) I have written up a patch which would make kenv
 function a bit more like sysctl, wrt the fact that sysctl -n
 suppresses suffixing a value with the variable name when executed
 like so:
 
 # kenv LINES
 LINES=24
 # kenv -n LINES
 24
 
 I've also considered keeping the functional defaults and instead
 do the following...
 
 # kenv -v LINES
 LINES=24
 # kenv LINES
 24
 
 Pro of the first form is that it matches sysctl, pro of the
 second form is that it doesn't break backwards 'compatibility'. I
 know kenv isn't a widely used utility (albeit, I have seen it used in
 a few spots outside of FreeBSD proper), but I was wondering if anyone
 could see any potential pitfalls or would have a large degree of
 heartburn over changing the default to match sysctl. Thanks!
 -Garrett___
 freebsd-hackers@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To
 unsubscribe, send any mail to
 freebsd-hackers-unsubscr...@freebsd.org

Hi Garret,

I use it for embedded, kenv is good transport shared by loader, kernel
and userland (since there is no RW storages).

IMO, kenv != sysctl, so we not need to match sysctl. But backwards
'compatibility' is good reason to select second way.

Thanks.

WWW
-- 
Aleksandr Rybalko r...@ddteam.net
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Thoughts about kenv emulating sysctl

2012-05-09 Thread Garrett Cooper
Hi Aleksandr!

On Wed, May 9, 2012 at 3:02 PM, Aleksandr Rybalko r...@ddteam.net wrote:
 On Wed, 9 May 2012 09:05:47 -0700
 Garrett Cooper yaneg...@gmail.com wrote:

...

 Hi Garret,

 I use it for embedded, kenv is good transport shared by loader, kernel
 and userland (since there is no RW storages).

Indeed.

 IMO, kenv != sysctl, so we not need to match sysctl. But backwards
 'compatibility' is good reason to select second way.

Which is what I figured; I favored the latter course at first and
developed my patch based on that mindset, because I know people hate
it when backwards compatibility is broken :) (in all fairness I'm
generally one of them).

Thanks!
-Garrett
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org