From owner-freebsd-arch Sun Aug 5 7:13:16 2001 Delivered-To: freebsd-arch@freebsd.org Received: from Awfulhak.org (gw.Awfulhak.org [217.204.245.18]) by hub.freebsd.org (Postfix) with ESMTP id CBA5D37B405 for ; Sun, 5 Aug 2001 07:13:10 -0700 (PDT) (envelope-from brian@Awfulhak.org) Received: from hak.lan.Awfulhak.org (root@hak.lan.Awfulhak.org [172.16.0.12]) by Awfulhak.org (8.11.4/8.11.4) with ESMTP id f75ECwj00895; Sun, 5 Aug 2001 15:12:58 +0100 (BST) (envelope-from brian@lan.Awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by hak.lan.Awfulhak.org (8.11.4/8.11.4) with ESMTP id f75ECwu42771; Sun, 5 Aug 2001 15:12:58 +0100 (BST) (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200108051412.f75ECwu42771@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Dima Dorfman Cc: arch@FreeBSD.ORG, brian@freebsd-services.com Subject: Re: Library routine to load a kld if it already isn't In-Reply-To: Message from Dima Dorfman of "Fri, 03 Aug 2001 13:31:01 PDT." <20010803203106.447343E35@bazooka.unixfreak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 05 Aug 2001 15:12:58 +0100 From: Brian Somers Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Programs that control a certain driver or set of drivers (e.g., > ifconfig, ccdconfig, mdconfig) attempt to load the module they'll be > working with if it isn't already present. They do it in different > ways, and the most correct way (i.e., the one that handles the most > cases properly) is liable to change if the kld subsystem ever changes. > I propose to add a library routine, kldmaybeload(3), that will check > if a certain module is present in the kernel, and load it if it isn't. > This will cut down on duplicated code, and may save some headaches > later if the kld interface changes. > > Sharball of the implementation and man page is attached (extract into > src/lib/libc/gen). Comments? Suggestions? This is normally done with: if (modfind("module") == -1 && ID0kldload("module") == -1) errx(); I don't think it's a good idea to change this. -- Brian http://www.freebsd-services.com/ Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message