Date: Wed, 26 Sep 2007 11:21:58 -0400 From: John Baldwin <jhb@freebsd.org> To: "Constantine A. Murenin" <cnst@freebsd.org> Cc: Perforce Change Reviews <perforce@freebsd.org> Subject: Re: PERFORCE change 126230 for review Message-ID: <200709261121.58419.jhb@freebsd.org> In-Reply-To: <200709091800.l89I0aM5060616@repoman.freebsd.org> References: <200709091800.l89I0aM5060616@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday 09 September 2007 02:00:36 pm Constantine A. Murenin wrote: > http://perforce.freebsd.org/chv.cgi?CH=126230 > > Change 126230 by cnst@dale on 2007/09/09 18:00:16 > > put in a hack for supporting "Sysctl internal magic", > and now hw.sensors tree magically works in sysctl(8)! > > dale# sysctl hw.sensors.{lm0.volt{0,1,2,3},cpu{0,1}} > hw.sensors.lm0.volt0: 1.23 VDC (VCore) > hw.sensors.lm0.volt1: 12.30 VDC (+12V) > hw.sensors.lm0.volt2: 3.33 VDC (+3.3V) > hw.sensors.lm0.volt3: 3.31 VDC (+3.3V) > hw.sensors.cpu0.temp0: 28.00 degC > hw.sensors.cpu1.temp0: 28.00 degC > dale# > > (All other utilities continue working using a cross-platform > sysctl(3) interface, compatible with OpenBSD.) > > +#endif /* !NOSYSCTL8HACK */ > + > + > +#ifndef NOSYSCTL8HACK > + > +/* > + * XXX: > + * FreeBSD's sysctl(9) .oid_handler functionality is not accustomed > + * for the CTLTYPE_NODE handler to handle the undocumented sysctl > + * magic calls. As soon as such functionality is developed, > + * sysctl_sensors_handler() should be converted to handle all such > + * calls, and these sysctl_add_oid(9) calls should be removed > + * "with a big axe". This whole sysctl_add_oid(9) business is solely > + * to please sysctl(8). Actually, sysctl_add_oid(9) is how you should add a tree of sysctl's on the fly to FreeBSD. It frees you from having to manually simulate a sysctl tree yourself and instead focus on just handling the functionality for the leaf nodes. If you just gave each sensor its own sysctl ctx and tree most of your in-kernel code for dealing with 'hw.sensors' would go away as it would just be a normal node ala 'dev'. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709261121.58419.jhb>