Re: file/device i/o in the kernel

From: Sharad Joshi (sharad.joshi@wipro.com)
Date: Fri Jun 16 2000 - 06:05:39 EST


Marc SCHAEFER <schaefer@alphanet.ch> wrote:
>In article
<Pine.LNX.4.10.10006161114150.1519-100000@yaksha.wipinfo.soft.net> you
wrote:
>> How to do file i/o in the kernel? Typically, i am opening a device file
>> (/dev/ttyS0) with sys_open(). Now i do sys_read/write on the returned
fd.
>> But the problem is, if i try to do it again after some time (uh... i
come
>
>In what context are you running ? If it's from interrupts, you DO NOT
>HAVE the right to do that. If a user process has syscalled your module
>(read(), write(), open(), ioctl()), then, why not do that
>in a user process completely ?

I want to open a device as a file within a kernel module. Is it possible to
do that? If not, what is the best way to do i/o (read/write) to the device
within the kernel.

Typically, i want to read/write something on /dev/ttyS0. But instead of
using inb/outb, i want to make use of the serial driver. So is it possible
to open the device ttyS0 with sys_open() and do sys_read/write? Or is there
any other way in which a kernel module can read/write to a device.

Sharad.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:11 EST