Re: file/device i/o in the kernel

From: Sharad Joshi (
Date: Fri Jun 16 2000 - 06:05:39 EST

Marc SCHAEFER <> wrote:
>In article
<> you
>> 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
>> But the problem is, if i try to do it again after some time (uh... i
>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.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

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