[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-arm-kernel
Subject:    Re: Why sys_open return EFAULT?
From:       Russell King - ARM Linux <linux () arm ! linux ! org ! uk>
Date:       2005-03-01 10:08:04
Message-ID: 20050301100804.A29818 () flint ! arm ! linux ! org ! uk
[Download RAW message or body]

On Tue, Mar 01, 2005 at 03:34:49PM +0800, daniel yu wrote:
> Hi, everyone:
>      I wrote a module, in which executes the sys_open("/dev/bi-pipe0", 0, 0);

This is where you're going wrong.  Under Linux, we have the general
rule that it is extremely bad taste for drivers to access files.

Take a moment to consider why.  Opening a file allocates a file
descriptor for the current process.  What happens if your module
then uses this file descriptor, but the current process is different.

-------------------------------------------------------------------
Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:       http://www.arm.linux.org.uk/armlinux/mlfaq.php
Etiquette: http://www.arm.linux.org.uk/armlinux/mletiquette.php
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic