Re: [squeak-dev] stdio

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] stdio

Eliot Miranda-2
 
Hi Bert, David, Ian, John,

On Sat, Dec 5, 2009 at 3:36 PM, Bert Freudenberg <[hidden email]> wrote:
On 04.12.2009, at 18:28, David T. Lewis wrote:
>
> On Fri, Dec 04, 2009 at 11:58:28AM -0500, Jason Rogers wrote:
>> Would it be possible to have Xtreams on STDIN, STDOUT, STDERR? Of
>> would that require use of OSProcess?
>
> On most unix boxes you should be able to use /dev/stdout as if it
> were a file, thus OSProcess should not be necessary. You'll need
> OSProcess if you want to set stdin for non-blocking reads to prevent
> blocking the VM.

Unfortunately, this does not work as reliably as actually using FDs 0, 1, and 2. I encountered at least one production system where I had to work around the issue on the VM level (*).

Since the VM maintainers didn't like my hack (which I can understand), maybe we could finally add the necessary primitives. There have been a couple proposals already. I'm not quite sure why none made it into the VM.

- Bert -

(*) http://dev.laptop.org/ticket/8194

FWIW here's the code in the Teleplace VM, and some code to use them for StandardFileStream. 

In sqFileStdioHandles-ccode are implementations of sqFileStdioHandlesInto: for platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c and platforms/win32/plugins/FilePlugin/sqWin32FilePrims.c

In  primitiveFileStdioHandles.st is the VMMaker code for the FilePlugin and the UnixOSProcessPlugin that uses sqFileStdioHandlesInto:.

In stdioHandles.st is code for StandardFileStream that allows the creation of streams on stdin stdout & stderr (untested on Win32).

HTH
Eliot

stdioHandles.st (5K) Download Attachment
primitiveFileStdioHandles.st (4K) Download Attachment
sqFileStdioHandles-ccode (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: [squeak-dev] stdio

David T. Lewis
 
On Sat, Dec 05, 2009 at 05:09:12PM -0800, Eliot Miranda wrote:

>  
> Hi Bert, David, Ian, John,
>
> On Sat, Dec 5, 2009 at 3:36 PM, Bert Freudenberg <[hidden email]>wrote:
> >
> > Since the VM maintainers didn't like my hack (which I can understand),
> > maybe we could finally add the necessary primitives. There have been a
> > couple proposals already. I'm not quite sure why none made it into the VM.
> >
> > - Bert -
> >
> > (*) http://dev.laptop.org/ticket/8194
>
>
> FWIW here's the code in the Teleplace VM, and some code to use them for
> StandardFileStream.
>
> In sqFileStdioHandles-ccode are implementations of sqFileStdioHandlesInto:
> for platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c and
> platforms/win32/plugins/FilePlugin/sqWin32FilePrims.c
>
> In  primitiveFileStdioHandles.st is the VMMaker code for the FilePlugin and
> the UnixOSProcessPlugin that uses sqFileStdioHandlesInto:.
>
> In stdioHandles.st is code for StandardFileStream that allows the creation
> of streams on stdin stdout & stderr (untested on Win32).
>
> HTH
> Eliot

Thanks Eliot,

For reference, here is the one I posted a while back:
http://lists.squeakfoundation.org/pipermail/vm-dev/2008-September/002022.html

This is similar to the Teleplace implementation, but uses no C support
code at the expense of some more code in the image. It works on Windows
if and only if we provide a hook for telling the Windows support code
that the fileID in question is legitimate (the Windows support code
keeps a registry of valid file handles). The Teleplace implementation
for Windows should work fine too, although I think it will require adding
some code to deal with the aforementioned registry in the Windows file
plugin.

As Bert points out, we are overdue for putting this into the VM so I
guess we should pick an implementation and get on with it. I have a
personal bias towards my own approach (*), so I wonder if we might
impose upon Bert to serve as the voice of the customer, pick one, and
tell us to just do it ;)

(*) because it can be used for pipe streams as well as stdin/out/err

Dave