Re: Call function on sysctl value change

2008-10-15 Thread Oliver Fromme
Matthew Jakeman wrote:
  I was wondering if it is possible to call a function when a sysctl value is 
  changed. I have added a few sysctl int variables to the kernel and for some 
  of these i only want certain values to be acceptable as input depending on 
  some conditions. I would like to be able to call a function if possible, to 
  validate the value entered via the sysctl command.

Yes, you can do this with a PROC type sysctl.  For example,
look at sysctl_hlt_cpus() in sys/i386/i386/mp_machdep.c.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH  Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

Whatever happened to the days when hacking started
at the cerebral cortex, and not at the keyboard?
  --  Sid on userfriendly.org by Illiad, 2007-06-20
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Call function on sysctl value change

2008-10-15 Thread Dag-Erling Smørgrav
Matthew Jakeman [EMAIL PROTECTED] writes:
 I was wondering if it is possible to call a function when a sysctl value is 
 changed.

grep -r SYSCTL_ADD_PROC /usr/src/sys

DES
-- 
Dag-Erling Smørgrav - [EMAIL PROTECTED]
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Call function on sysctl value change

2008-10-15 Thread Matthew Jakeman
On Wednesday 15 October 2008, Dag-Erling Smørgrav wrote:
 Dag-Erling Smørgrav [EMAIL PROTECTED] writes:
  Matthew Jakeman [EMAIL PROTECTED] writes:
   I was wondering if it is possible to call a function when a sysctl
   value is changed.
 
  grep -r SYSCTL_ADD_PROC /usr/src/sys

 even better: 'man SYSCTL_ADD_PROC' will answer all your questions.

 DES

Thanks for that. It looks like just the job. Now exactly sure how I missed it 
in the first place but thanks...
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Call function on sysctl value change

2008-10-15 Thread Matthew Jakeman
Hi all,

I was wondering if it is possible to call a function when a sysctl value is 
changed. I have added a few sysctl int variables to the kernel and for some 
of these i only want certain values to be acceptable as input depending on 
some conditions. I would like to be able to call a function if possible, to 
validate the value entered via the sysctl command.

Thanks in advance
Matt
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]