Re: file/device i/o in the kernel

From: Marc SCHAEFER (schaefer@alphanet.ch)
Date: Fri Jun 16 2000 - 06:26:51 EST


On Fri, 16 Jun 2000, Sharad Joshi wrote:

> 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.

It completely depends in what context runs your driver. If your driver
runs on behalf of a task context (ie as a result of ioctl(), read()
write() into your driver), then I would presume it to be legal (are
deadlock possible?). Now, if this is e.g. from interrupt, this is not
right.

A way to implement it which will always be correct is to have a user-level
process in an endless loop of ioctl() in your driver, your driver passing
it the data to write to the serial port through the ioctl().

That could even work, assuming you have a properly handled queue, from
interrupts.

-
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