Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Oct 2008 16:17:30 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-hackers@FreeBSD.ORG, m.jakeman@lancaster.ac.uk
Subject:   Re: Call function on sysctl value change
Message-ID:  <200810151417.m9FEHUEn037917@lurza.secnetix.de>
In-Reply-To: <200810151343.28136.m.jakeman@lancaster.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810151417.m9FEHUEn037917>