PWS headless - misc. questions - OSProcess might help

Peter William Lount peter at
Mon Aug 30 16:10:56 UTC 1999

Hi David,

This looks really cool! I'll study it some more. Would it be possible for
you to post a working full set of vm, image, etc... files including sources
on the net somewhere? (If you need space I can put them on

I think that these changes to the base image really could make squeak much
more usefull in server and "unix" situations...

All the best,

Peter William Lount
peter at

From: David T. Lewis <lewis at>
To: squeak at
Subject: Re: PWS headless - misc. questions - OSProcess might help
Date: August 29, 1999 8:49 AM

On Wed, Aug 25, 1999 at 05:31:36PM -0700, Peter William Lount wrote:

> Is there a way to have Smalltalk level code read the virtual machine unix
> command line arguments... I'd like to have squeak read an optional
> for the port that it should serve pages on... This allows many copies of
> the same vm to be started simply via a single unix script...

The primitive to support SystemDictionary>>getSystemAttribute is only
partly implemented in the Unix sources (at least the version I have; maybe
it's been updated recently). The code is in sqXWindow.c if you want to
fix it up.

> I'd like to create a Apache Module if none exists, modsqueak, for Apache
> talk with squeak vm processes via a tcp packet or shared memory. However,
> it would still require squeak to be able to respond instantly to a
> packet without having to poll for the darn packet... 

As long as you are running this on some flabor of Unix, you may want
to have a look at the OSProcess code which I posted on a while back. Once you've filed
the changes in and built a new VM, you can do the following possibly
useful things:

Get an array of all the command line arguments:
 "OSProcess thisSqueakOSProcess arguments inspect"

Start a headless image for your PWS, cloned from a running image but
without a display (the original image keeps running also):
 "UnixProcess forkHeadlessSqueakAndDoThenQuit: aBlockToStartUpThePWS"

I don't know how Apache modules work, but if you just need access to
stdin, stdout and stderr (like for a CGI script), then these are
accessible as:
 "OSProcess thisSqueakOSProcess stdIn"
 "OSProcess thisSqueakOSProcess stdOut"
 "OSProcess thisSqueakOSProcess stdErr"
The standard input stream does blocking reads, which would be good for
a CGI script, since it does not leave Squeak in a polling loop while
waiting for input.

OSProcess works on the new 2.5 image (with the 2.4 code base for the VM).
If the VM code you are using is newer than mine (I think Ian has been
working on it since the 2.4 release), you may need to hack sqXWindow.c
a bit on your own, but it's pretty straightforward. This should run fine
on FreeBSD (I wrote in under Linux), but I'd appreciate if someone can
confirm that for me.

The code I posted on the swiki seems to evaporate from time to time. I
reloaded it this morning so you can grab it from the swiki, but just send
me email if you have trouble getting it.

Hope this helps.

More information about the Squeak-dev mailing list