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 http://www.smalltalk.org).
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@smalltalk.org http://www.smalltalk.org
---------- From: David T. Lewis lewis@mail.msen.com To: squeak@cs.uiuc.edu 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
argument
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
to
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
incoming
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 http://minnow.cc.gatech.edu/squeak.708 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.
On Mon, Aug 30, 1999 at 09:10:56AM -0700, Peter William Lount wrote:
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 http://www.smalltalk.org).
I would need to build this for you on FreeBSD (that's what you're running, right?). I can probably do that, but I won't have time to get around to it for a week or two. If you don't mind having a bash at building it yourself, I'd actually appreciate some feedback on whether the instructions are clear enough and whether the build goes smoothly on your platform.
By the way, you can load the change set if you want to just want to browse the Smalltalk side. You should probably plan to have about an hour of free time to kill if you want to build the VM and shared libraries.
I think that these changes to the base image really could make squeak much more usefull in server and "unix" situations...
This will require small but inconvenient changes to a couple of the interpreter support files from Squeak Central. I suspect that if there is interest, we could request it for some future release.
On the Smalltalk side, I suspect that this stuff may not really belong in the base image due to its platform dependencies, but I would be pleased if anyone holds a contrary opinion.
squeak-dev@lists.squeakfoundation.org