From owner-freebsd-current@FreeBSD.ORG Sun Oct 7 16:17:15 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BB5FC106578E; Sun, 7 Oct 2012 16:17:15 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id B42948FC0C; Sun, 7 Oct 2012 16:17:10 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.5/8.14.5) with ESMTP id q97GH4ep014714; Sun, 7 Oct 2012 10:17:04 -0600 (MDT) (envelope-from freebsd@damnhippie.dyndns.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id q97GGfM0078240; Sun, 7 Oct 2012 10:16:41 -0600 (MDT) (envelope-from freebsd@damnhippie.dyndns.org) From: Ian Lepore To: Luigi Rizzo In-Reply-To: <20121007155356.GA77558@onelab2.iet.unipi.it> References: <20121006172834.GB63649@onelab2.iet.unipi.it> <20121007104330.GA75115@onelab2.iet.unipi.it> <20121007150219.GA76853@onelab2.iet.unipi.it> <20121007155356.GA77558@onelab2.iet.unipi.it> Content-Type: text/plain; charset="us-ascii" Date: Sun, 07 Oct 2012 10:16:40 -0600 Message-ID: <1349626600.1112.30.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Garrett Cooper , Adrian Chadd , current@freebsd.org Subject: Re: sysctl vs ifconfig vs other (was Re: sysctl-controlled key-value store ?) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 16:17:15 -0000 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