From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 17 13:44:55 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D75EE32C for ; Thu, 17 Oct 2013 13:44:55 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ob0-x231.google.com (mail-ob0-x231.google.com [IPv6:2607:f8b0:4003:c01::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A136D20ED for ; Thu, 17 Oct 2013 13:44:55 +0000 (UTC) Received: by mail-ob0-f177.google.com with SMTP id wm4so1842657obc.36 for ; Thu, 17 Oct 2013 06:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=zURyurxIdXAzZUBT44EOapBaS8Sg93X4VxL4zsCpNSM=; b=oYzw9TJtaUZXZYcOuxkse5/a+3bnKcP6n3HJK+95K1QiOXCwCnTNglkAxzGn3mY+ie T6AZmArehzHJDdmzcR2zYZD+l5ngcuwWGVtmhCdSkkAhQM3AT8MEHaF47F7LFdC3Fayq qxVT/CR/f4EKR/hcg20qzd0aJCVDvM2Pz07q34fn17aH7M0+GfE1Tpxxc1wXXUNgDsHt zQ/lCSRy71RHwU5q7VbGtP9/KnOHZLgjTkB8Sl5d0bo0Y08swhO4ymnxPg4PEw+B0BKh sXtGIGG1Vk02w6jIRPppYnIS6jTL88uiUI7rXvCHWu3IPHPsfUsxsLW4Oc+vjjrgnFdy AqvQ== MIME-Version: 1.0 X-Received: by 10.182.101.198 with SMTP id fi6mr281260obb.79.1382017493956; Thu, 17 Oct 2013 06:44:53 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.182.110.195 with HTTP; Thu, 17 Oct 2013 06:44:53 -0700 (PDT) In-Reply-To: <525FA92E.40506@embedded-brains.de> References: <525D5A35.4040005@embedded-brains.de> <525FA92E.40506@embedded-brains.de> Date: Thu, 17 Oct 2013 06:44:53 -0700 X-Google-Sender-Auth: Zy8bjMA6dQb59Nn53ooBlINxVzc Message-ID: Subject: Re: Global variables in system programs From: Matthew Fleming To: Sebastian Huber Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Eitan Adler , FreeBSD Hackers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2013 13:44:56 -0000 On Thu, Oct 17, 2013 at 2:09 AM, Sebastian Huber < sebastian.huber@embedded-brains.de> wrote: > On 2013-10-17 03:45, Eitan Adler wrote: > >> On Tue, Oct 15, 2013 at 11:07 AM, Sebastian Huber >> > >> wrote: >> >> These programs use some global variables. In a statically linked >>> context we >>> have now the following problems >>> >> >> This is a pretty awesome idea. I've seen some work like this but it >> would be great to get FreeBSD into a state where this is easy. >> > > If it is acceptable for the FreeBSD project to turn e.g. ROUTE(8) and > IFCONFIG(8) into library functions then this would be great. I can do the > work. At a meta level, IMO *most* of the functionality in binaries should be in libraries. How many times writing a C unit test have I wanted to do rm -rf of the temporary files I created? But the recursive remove is in rm(1) not in libutil. And it sounds like the functionality in route/ifconfig is now desired to be accessed programatically, not just from a shell script. So +1 for moving code into a library where it can be re-used. Cheers, matthew