From owner-freebsd-arch Sat Aug 4 6:38:44 2001 Delivered-To: freebsd-arch@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 5E69337B403; Sat, 4 Aug 2001 06:38:41 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: by bazooka.unixfreak.org (Postfix, from userid 1000) id 067FB3E31; Sat, 4 Aug 2001 06:38:40 -0700 (PDT) Received: from bazooka.unixfreak.org (localhost [127.0.0.1]) by bazooka.unixfreak.org (Postfix) with ESMTP id EA4053C12B; Sat, 4 Aug 2001 06:38:40 -0700 (PDT) To: Ben Smithurst Cc: arch@freebsd.org Subject: Re: Library routine to load a kld if it already isn't In-Reply-To: <20010804074928.A66860@strontium.shef.vinosystems.com>; from ben@FreeBSD.org on "Sat, 4 Aug 2001 07:49:28 +0100" Date: Sat, 04 Aug 2001 06:38:35 -0700 From: Dima Dorfman Message-Id: <20010804133840.067FB3E31@bazooka.unixfreak.org> 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 Ben Smithurst writes: > Dima Dorfman wrote: > > > X.Sh ERRORS > > XAn attempt to load the module may fail for the following reasons: > > X.Bl -tag -width Er > > X.It Bq Er EPERM > > I think I'd prefer this section be reduced to > > kldmaybeload() may fail and set errno for any of the errors > specified for the routines modfind(2) and kldload(2). > > in the way other libc manual pages do. That way, there's just one less > place to update when additional error possibilities are added to those > functions. Adding error possibilities is a change in the interface, and shouldn't done lightly. Nonetheless, I agree with your idea in general, although the text you propose is inaccurate. It doesn't use modfind(2), it uses kldnext(2), kldfirstmod(2), modfnext(2), modstat(2), and kldload(2). Of all of those, only kldstat(2) should fail. If any of the others fail, there's either a bug in the routine, or a bug in the kernel. (One bug is known: if the module it's currently checking is unloaed before it calls modfnext(2), or the file is unloaded before it calls kldnext(2), those functions will fail with ENOENT. Now that I think about it, it might be good to document that.) Thanks for your comments. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message