Messages in this thread | | | Date | Mon, 17 Nov 2003 09:48:32 +0000 | From | viro@parcelfa ... | Subject | Re: seq_file and exporting dynamically allocated data |
| |
On Mon, Nov 17, 2003 at 01:03:39AM -0800, William Lee Irwin III wrote: > On Mon, Nov 17, 2003 at 12:48:04AM -0800, William Lee Irwin III wrote: > > There's a retry loop where the buffer size is doubled each iteration > > that looks to me like automagic sizing in the code for seq_read(). I > > can't say I've actually tried to rely on getting more than a page > > at a time through seq_read(), though. > > Woops. This looks like it only makes sure there's enough to get the > first ->show() into the buffer; I see that it later gives up when > m->count == m->size once the first ->show() has enough bufferspace to > complete later on. So if all ->show() operations to do are less than > PAGE_SIZE, it'll never hand back more than a page at a time, and may > hand back short reads prior to EOF, which doesn't bode well for my > short read == EOF idea (maybe not a great assumption in general).
That's "broken assumption", thank you very much. There is one and only one indication of EOF - read() returning 0. Any application that treats short read as EOF is broken. As in "apply Stevens to offender's cranium until something gives; if it's the book, replace with fresh copy and repeat". - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |