From owner-freebsd-questions Mon Mar 11 14:30:19 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by hub.freebsd.org (Postfix) with ESMTP id E828F37B400 for ; Mon, 11 Mar 2002 14:30:03 -0800 (PST) Received: from hades.hell.gr (patr530-b218.otenet.gr [212.205.244.226]) by mailsrv.otenet.gr (8.12.2/8.12.2) with ESMTP id g2BMU11S017377; Tue, 12 Mar 2002 00:30:02 +0200 (EET) Received: from hades.hell.gr (hades [127.0.0.1]) by hades.hell.gr (8.12.2/8.12.2) with ESMTP id g2BMToY2002897; Tue, 12 Mar 2002 00:29:57 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from charon@localhost) by hades.hell.gr (8.12.2/8.12.2/Submit) id g2BM7oAV002675; Tue, 12 Mar 2002 00:07:50 +0200 (EET) (envelope-from keramida@freebsd.org) X-Authentication-Warning: hades.hell.gr: charon set sender to keramida@freebsd.org using -f Date: Tue, 12 Mar 2002 00:07:50 +0200 From: Giorgos Keramidas To: yonder Cc: freebsd-questions@freebsd.org Subject: Re: writing interrupt handlers Message-ID: <20020311220749.GB2388@hades.hell.gr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.27i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-03-11 13:07, yonder wrote: > I recently rediscovered some old DOS (the OS, not DoS!!!) turbo pascal > code I wrote back in high school in which I wrote an interrupt handler, > placed its address in the interrupt vector table, and returned control > to the original handler when my new one was finished. I was wondering > if there was a standard way to do this in *NIX C. For example, I could > write a short function to load a sound and play it every time a key is > pressed... and then return control to the original handler to process > the keypress correctly. The functionality is already there. This is something that can be done with a kernel module of some sort... The thing is that under DOS, there wasn't the notion of 'users', since it is not a multiuser OS. This is why only the superuser is allowed to 'load modules' in a running FreeBSD kernel. This is done for a good reason too. Kernel modules have access to the kernel data structures, and can bring the kernel down if they do funny things. Allowing everyone to load or unload arbitrary kernel modules would be equivalent to giving everyone the permission to panic() the kernel whenever they felt like it :-) Giorgos Keramidas FreeBSD Documentation Project keramida@{freebsd.org,ceid.upatras.gr} http://www.FreeBSD.org/docproj/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message