[Vm-dev] Stdin/stdout/stderr support

Bert Freudenberg bert at freudenbergs.de
Sun Aug 31 21:39:33 UTC 2008

Am 31.08.2008 um 22:36 schrieb David T. Lewis:

> On Sat, Aug 30, 2008 at 04:43:46PM +0300, Igor Stasenko wrote:
>> 2008/8/30 David T. Lewis <lewis at mail.msen.com>:
>>> For example, here is the Windows implementation from OSPP:
>> Good, but maybe it can be more simplier?
>> Just return a valid file handle on success, or fail primitive if not.
> Sure. That's what I did for the Unix flavor, and I don't recall why
> I did it differently for win32. I think that it was a convenient way
> to tell whether the Windows console was open or not.
>> Also, it can be a single prim (primitiveGetStdFileHandle) , with
>> additional argument indicating which std stream to return e.g.
>> 0 - for stdin
>> 1 - for stdout
>> 2 - for stderr
> I preferred the three separate methods versus "magic numbers", but
> either way is fine.
> One other thing I might mention. The stdin stream is dangerous because
> it will hang the image on a blocking read if no data is available.
> For OSPP I added primitives to set nonblocking I/O, and this would
> need to be addressed if stdin access is made part of the normal VM.

Also, the standard behavior is to seek to the beginning of the file.  
For stderr and stdout this should not happen.

I'd prefer a single primitive instead of three (which admittedly is  
more clean than a magic filename).

- Bert -

More information about the Vm-dev mailing list