From owner-freebsd-hackers Tue Aug 14 12:18:20 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 1251F37B405 for ; Tue, 14 Aug 2001 12:18:16 -0700 (PDT) (envelope-from iedowse@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 14 Aug 2001 20:18:15 +0100 (BST) To: Sansonetti Laurent Cc: freebsd-hackers@freebsd.org Subject: Re: Reading files within the kernel (was Re: allocating userland space...) In-Reply-To: Your message of "Tue, 14 Aug 2001 01:10:19 +0200." <003401c1244d$1fa6ee80$0201a8c0@teledisnet.be> Date: Tue, 14 Aug 2001 20:18:14 +0100 From: Ian Dowse Message-ID: <200108142018.aa65178@salmon.maths.tcd.ie> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <003401c1244d$1fa6ee80$0201a8c0@teledisnet.be>, Sansonetti Laurent w rites: >A another stupid question, how can I do to stop the loading process in >MOD_LOAD event handler (in my case, if the cfg file doesn't exist, it should >be better to interrupt..) ? Someone else might a have better idea of how this works, but it seems to me that the best you can do is printf a descriptive error message and return a non-zero value from the module event handler function. The return code from the event handler will be printed on the console by the kernel, and the event handler will then immediately be called with MOD_UNLOAD. It seems that the KLD is not actually unloaded in this case, and no error is returned to the kldload process, but the user can then manually unload the KLD, correct the problem and try again. That's just from a quick read of the code so it may be wrong. Try adding printf's to the MOD_LOAD and MOD_UNLOAD cases in the event handler, and see what happens when MOD_LOAD returns non-zero. Ian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message