Re: sysctl vs ifconfig vs other (was Re: sysctl-controlled

看板FB_current作者時間13年前 (2012/10/08 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/4 (看更多)
On Sun, 07 Oct 2012 10:16:40 -0600 Ian Lepore <freebsd@damnhippie.dyndns.org> wrote: > On Sun, 2012-10-07 at 17:53 +0200, Luigi Rizzo wrote: > > Access through sysctl is incredibly easy from both userspace and > > from a C application, because all the work is done in the kernel > > side, whereas other mechanisms (ioctl, i'd rather leave kvm apart > > as we really don't want that!) require the definition of a specific > > API (ioctl, structs) _and_ some amount of wrapping code in > > userspace. > > > > cheers > > luigi > > A potential problem with sysctl is its "one thing at a time" nature. > When you pack up a bunch of related data into a structure and hand it > off to an implementation, that implementation can pretty easily make > sure that all the data related to the config request is sane. If you > have to make a series of sysctl calls to achieve some complex config > task, what happens when you're 2/3 of the way through the series and a > call fails? Who backs out the partial config that got accomplished? > > If you go too far down this path you end up with something that looks > a lot like the unmitigated mess which is the SNMP control API. > > -- Ian I agree with Ian here. As messy as ioctl+structs are from a user standpoint, they're the easiest way to guarantee atomic configuration changes. - Justin _______________________________________________ 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): #1GSSDVjv (FB_current)
文章代碼(AID): #1GSSDVjv (FB_current)