[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: file/device i/o in the kernel

+ > 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?
+ Are you sure that the "current" process was the same at open() and
+ read() ? If not, that is your problem.

I guessed that, but how to find that 'current' thing was same at the time
of both calls. And how to 'save' the fd, that i got, across rescheds. I am
not a serious kernel hacker :) and so have no idea about that. BTW, even
if the 'kernel process' was rescheduled, file fds and all that must have
been stored, or am i wrong?

+ > 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?
+ Not use file descriptors and do IO at a lower level ? struct file or
+ whatever it is that linux implements.

Yeah, but that means meddling with BIG data structs. I thought there was
some cleaner way other than relaying on sys_... calls.