=== Top of the Swiki === Attachments ===
OSProcess
OSProcess for Unix Squeak - Version 1.4
OSProcess provides access to operating system functions, including pipes and child process creation. It is implemented using pluggable primitives in a loadable module for Linux and will probably work on most Unix systems. The Smalltalk code, including the classes which implement pluggable primitives for Unix operating system functions, may be loaded into any Squeak image, but the primitives are only useful on Unix systems. Placeholder classes are provided for Mac and Windows, but are not implemented here.
Download version 1.4 from http://swiki.gsug.org:8080/sqfixes/1122.html
Changes in 1.4 since 1.3:
- Split UnixOSProcessAccessor into two classes. UnixOSProcessPlugin now contains the methods which can be translated to a C plugin library, and UnixOSProcessAccessor no longer contains the plugin code. Cleaned up some of the plugin code to minimize C compiler warnings for strict compilers.
- Added various improvements to child process handling, particularly across image restarts. Added a primitive to UnixOSProcessPlugin to allow Squeak to check if a child process still exists following an image restart. ExternalOSProcess proxies now do a better job of keeping track of the external OS processes which they represent.
- Added UnixProcess class>>makeVM utility for rebuilding the VM from a running Squeak session.
Download version 1.3 from http://swiki.gsug.org:8080/sqfixes/1031.html
This version is updated for Squeak 2.8 and 2.9a. If you are building your Unix VM from the SourceForge repository, you should update your OSProcess to this new version.
The Unix plugin module name has been changed to UnixOSProcessPlugin.c. This is for consistency with other pluggable modules for the new pluggable VM.
The Smalltalk code is not backwardly compatible, because the primitive calling methods have been changed to use the new module name.
OSProcess for Unix Squeak - Version 1.2
Note to SourceForge VM folks: If you are using the pluginized VM, you will need to move the declaration of thisSession from sqFilePrims.c to sqXWindow.c. However, since sqFilePrims.c is one of the common modules exported from the image, I don't want to hack it on SF. Therefore, until I think of a better approach, you can fix your local sources as follows:
In sqFilePrims.c, change the declaration to:
extern int thisSession;
And in sqXWindow.c, add a declaration:
int thisSession = 0;
Download version 1.2 from http://swiki.gsug.org:8080/sqfixes/981.html
OSProcess for Unix Squeak - Version 1.1
Updated for Squeak 2.7.
Files are contained in the OSProcessV1-1-2.zip zip archive.
OSProcessV1-1-2.zip fixes an error in sqXWindow.c from the OSPRocessV1-1.zip version, and adds support for a "-headless" command line option for Unix. There are no other changes since OSProcessV1-1. dtl 2-April-2000.
OSProcess for Unix Squeak - Version 0.4
Release notes for version 0.4: Readme-OSProcessV0.4
Files:
osprocessv0.4.src.tgz C source files
osprocess.4octo1251pm.cs Smalltalk source
osprocessv0-4-linux-2-2-10.tgz Linux binaries (lib6)
osprocessv0-4-linux-2-0-35.tgz Linux binaries (older system)
osprocessv0-4-freebsd-2-2-6.tgz FreeBSD binaries
OSProcess for Unix Squeak - Version 0.3 (original release)
Files:
Readme-OSProcessV0.3 Readme file for OSProcess
OSProcess.5July250pm.cs The change set - file this in to your image
OSProcessV0.3.tar.gz Supporting files in gzipped tar format
OSProcessV0.3.zip Same supporting files, but in zip format
sqXWindow.c.diff-OSProcessV0.3 For convenience, a diff of the sqXWindow.c changes
Current capabilities include:
Inspect the OS process in which Squeak is running: "OSProcess forThisOSProcess inspect"
Read standard input, and write standard output and standard error streams.
Create operating system pipes and attach them to AttachableFileStream streams.
Create Unix child processes with protocol similar to (same as?) VisualWorks.
Clean up child processes automatically on exit (a Semaphore is set after receiving a SIGCHLD signal), with child exit status available in Squeak.
Start a second Squeak in a child process, restarting the child from the last saved image file: "UnixProcess squeak"
Clone the running Squeak image, producing two nearly identical Squeaks running from the same object memory at the time of cloning: "UnixProcess forkSqueak"
Clone the running Squeak image, but with no display connection for the child: "UnixProcess forkHeadlessSqueakAndDo: aBlock"
Clone the running Squeak image with no display connection, execute a block, and exit (similar to running a command from a Unix shell, except that the "command" is a Smalltalk block): "UnixProcess forkHeadlessSqueakAndDoThenQuit: aBlock"
Notes:
If you are using a non-Unix platform, you can just file in the Smalltalk files and have a look around. All of the code except for some minor patches to the existing Unix support files is written in Smalltalk. On Unix systems, some patches to sqXWindow.c (the C main program) are required in order to permit access to the command line, environment, stdio, stdout, and stderr. A patch file for this and for the makefile changes is included here.
There are also changes to the interpreter support files to provide access to SQFile data structures from pluggable primitives. The changes do not effect the rest of the Squeak system, but they do require a one time rebuild of the virtual machine and all the dynamically loaded modules. The OSProcess primitives are implemented as pluggable primitives in a loadable module. There are no changes to the base VM other than those described above.
Installation:
These notes are from the 0.3 release. Release 0.4 provides binaries for some systems, but building from source is left as an exercise
for the reader (at least until the next update of the Unix VM source code is available).
To add OS Process support to Squeak on Linux (and probably other Unix systems), follow these steps for the quick installation, or (for the more patient and inquisitive) the bootstrap installation.
Quick Install
Bootstrap Install