[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
file/device i/o in the kernel
Any idea how to do file i/o in 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) 400 MHz here.