Re: do we have a generic string-number sysctl mapping library ?

看板FB_current作者時間11年前 (2014/06/27 17:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/5 (看更多)
On Fri, 27 Jun 2014 11:14+0200, Luigi Rizzo wrote: > Hi, > I have frequently found myself using sysctls to control some kernel > feature where a string would be a better (and sometimes the only) > option than using a numeric value, yet the internal representation > should be numeric for speed and robustness. > Examples are the kern.timecounter, the default scheduler in dummynet, > and now in netmap the selection between native and emulated mode. > I am sure many of you can come up with other cases. > = > I wonder if we have some support for that already in the sysctl code, > or i should build a generic one next time i need to do that. In C, according to sysctl(3) you could use sysctlnametomib(). I might have misinterpreted the problem domain. > Feel free to criticise the approach and suggest better ones. > Right now i am using sysctls because i have a set of macros > and wrapper functions that let me convert them to sysfs > entries when building kernel code on linux, so I have a > portable solutions. > = > For the details, I'd like to have a mechanism that requires the > kernel programmer supply a (possibly extensible) table of > supported values, and matching constants to be used within > the kernel. A single declaration should generate entries > to get/set the current value as well as list options. > We can discuss frills (such as wildcards, multiple values,etc). > = > cheers > luigi -- = +-------------------------------+------------------------------------+ | Vennlig hilsen, | Best regards, | | Trond Endrest=F8l, | Trond Endrest=F8l, | | IT-ansvarlig, | System administrator, | | Fagskolen Innlandet, | Gj=F8vik Technical College, Norway, | | tlf. mob. 952 62 567, | Cellular...: +47 952 62 567, | | sentralbord 61 14 54 00. | Switchboard: +47 61 14 54 00. | +-------------------------------+------------------------------------+ _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
文章代碼(AID): #1JhJeJPd (FB_current)
討論串 (同標題文章)
文章代碼(AID): #1JhJeJPd (FB_current)