|
From: KJK::Hyperion <no...@li...> - 2002-05-03 20:01:05
|
At 10.16 03/05/2002, you wrote: > >not sure. Stdio FILE objects are supposed, AFAIK, to maintain their > >internal buffer, exactly to avoid the overhead of a system call to > >read a single character >I think you're right (btw wine's msvcrt functions call readconsole 1 char >at a time, so porting may be a bad idea after all). argh. Not only a system call, but a potential RPC call at each character read! [...] >BUT _read (in msvcrt\io\read.c) doesn't want to return until it's read the >size requested (filebuf asks for 4096), even if enter is pressed. So it >seems that's the problem. If we wanted buffered reading to limit system >call overhead, then _read must return if enter is pressed and the file in >use is stdin. What do you think about this? This behavior of read() is non-standard (I don't know if it's done for compatibility with Microsoft's CRT). A call to read() reading less than expected is still considered successful: "[...] If a read() is interrupted by a signal after it has successfully read some data, it will return the number of bytes read. [...]" |