Accessing sysctls from kernel

Bruce M Simpson bms at spc.org
Thu Feb 26 05:32:03 PST 2004


On Thu, Feb 26, 2004 at 02:10:40PM +0100, Ivan Voras wrote:
> In sys/sys/sysctl.h I see function kernel_sysctlbyname() that looks (to 
> me) to be intended for accessing sysctl values from kernel, but for it's 
> first parameter it requires a struct thread *td.
> 
> What should I pass to it? (I'm calling it from inside a screensaver module)

You could try lying about which thread you are, when you aren't in
a userland thread:

Cscope tag: kernel_sysctlbyname
   #   line  filename / context / line
   1    728  /sys/dev/vinum/vinumio.c <<vinum_scandisk>>
             error = kernel_sysctlbyname(&thread0, "kern.disks", NULL,
   2    741  /sys/dev/vinum/vinumio.c <<vinum_scandisk>>
             kernel_sysctlbyname(&thread0, "kern.disks", devicename,
   3    305  /sys/i386/i386/elan-mmcr.c <<init_AMD_Elan_sc520>>
             i = kernel_sysctlbyname(&thread0, "machdep.i8254_freq",

BMS


More information about the freebsd-hackers mailing list