file/device i/o in the kernel

From: Sharad Joshi (sharad.joshi@wipro.com)
Date: Fri Jun 16 2000 - 00:47:44 EST


Hio,

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
back to do read/write) both these return with 'Bad file Descriptor' error.
If i try to do sys_open() again (ok, i close the former fd), it returns 0.
I have scanned thru all the relevent source of the kernel, but find no
clue as to why this happens. Any idea?

What is the better way to do device i/o above the driver? If a kernel
module wants to do some device i/o using underlying driver, is the above
method ok, or i need to do something else?

'using 2.2.13k on Celeron (Mendocino) here.

TIA,
Sharad.

P.S. Please Cc the replies to me, i am not subscried to this list.

-
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:10 EST