Messages in this thread | | | From | "Peter T. Breuer" <> | Subject | tell eof from eob? how? | Date | Sun, 19 Mar 2000 20:58:32 +0100 (MET) |
| |
I'm reading a buffer in the kernel, the buffer having been delivered by a VFS write operation. But I need to interpret complete lines, so if I get given a 4096 char buffer and the last linefeed is at the 4090 char mark, I reply that I've seen 4090 chars. The kernel then gives me the remaining 6 chars again in a following call.
Great.
But I need the next 6+n chars, or we'll play this game forever.
How can I tell that there is more to come? If I try to save the leftovers from call to call, how do I know that the next call is the remaining part that I'm interested in? Or how can I persuade the kernel to give me 6chars of the old buffer plus 4090 of the next?
This results from a cat foo > /proc/bar, by the way. This is what I see:
Mar 19 20:40:51 bambam kernel: write_proc entered with file c22ebc20, buff bfffd194, count 4096, data 0 Mar 19 20:40:51 bambam kernel: write_proc returned count 4074 Mar 19 20:40:51 bambam kernel: write_proc entered with file c22ebc20, buff bfffe17e, count 22, data 0 Mar 19 20:40:51 bambam kernel: write_proc returned count 1 Mar 19 20:40:51 bambam kernel: write_proc entered with file c22ebc20, buff bfffe17f, count 21, data 0 Mar 19 20:40:51 bambam kernel: write_proc returned count 1 ...
Well, the file pointer might be a clue, I suppose. I'm returning 1 instead of 0 to avoid infinite gameplay here.
Peter
- 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/
| |