[ENH][GOODIE] OSProcess V1.2

David T. Lewis lewis at mail.msen.com
Sat Jul 15 17:25:07 UTC 2000


OSProcess is contributed under the terms of Squeak-L. Please copy freely.

This release contains a number of refactorings, fixes, and improvements
to the representation of external OS processes.

Packaged prior to release of 2.8 Unix VMs. This version should work
with Ian's standard code base (no modifications to sqXWindow.c).
If you are not keeping up with the Unix source code, I suggest that
you wait until a new VM is released to save yourself the aggrivation
of building everything from scratch. I'll retest everything when the
2.8 VMs stabilize, but I don't expect any problems.

In addition to the change set, I am also attaching a copy of the
C source for the Unix plugin, and a tar with a compiled Linux
UnixOSProcessAccessor.so which may be useful for some people. However,
I really recommend building everything from the change set (which of
course includes the UnixOSProcessAccessor code in Smalltalk).

VM builders and web sites: Please feel free to distribute the source and
compiled plugins for unix-like systems. I can only conveniently build
a Linux version, but if somebody puts a copy of UnixOSProcessAccessor.c
into the source tree, it should compile for most platforms. Please let
me know if this is not the case.

Dave
-----

Change set preamble:

"Change Set:		OSProcess
Date:			13 July 2000
Author:			David T. Lewis

OSProcess 1.2
Previous released version: 1.1.2

OSProcess provides access to the external operating system from Squeak.
A plugin is provided for Unix (and Linux) systems. Placeholder classes
are provided in the OSProcess hierarchy for other operating systems
(Windows, Mac, OS/2), but support for these systems is not yet implemented.

You can:
 - Open a inspector on the operating system process in which
   Squeak is running (OSProcess>>thisOSProcess).
 - Read or write on the stdin, stdout, and stderr streams.
 - Access the command line, and get or set environment variables.
 - Fork and exec external programs, with control of the command
   line, environment, and stdin/stdout/stderr.
 - Open an inspector on a child operating system process created
   from Squeak, with run state and exit status of the child updated
   asynchronously.
 - Run an external system command:
     UnixProcess command: 'xeyes'
 - Create pipes and connect them to external processes.
 - Fork an exact clone of the current running Squeak image (no
   image file) with parent and child Squeak processes proceeding
   from the same point in memory.
 - Fork another Squeak from a disk based image.
 - Start a headless Squeak from the running Squeak image, giving
   it an expression to evaluate.
 - Tell the running image to go headless with UnixProcess>>decapitate.
 - Restart the VM on the fly with UnixProcess>>restartVirtualMachine.
 - Start your Swiki in a headless background process:
	UnixProcess>>startSwiki: 'myswiki' onPort: 8081 loggingTo: 'log.txt'

The classes in OSProcess are:

  OSProcess 
    ExternalOSProcess 
      ExternalUnixProcess 
        ConnectedUnixProcess 
    ThisOSProcess 
      MacProcess 
      OS2Process 
      UnixProcess 
      WindowsProcess
  OSProcessAccessor
    MacOSProcessAccessor
    OS2OSProcessAccessor 
    UnixOSProcessAccessor
    WindowsOSProcessAccessor
  AttachableFileStream
  OSPipe
  ShellProxy
  ShellWindow

Changes in 1.2 since 1.1:
 - Refactored ShellProxy out of the ConnectedProcess hierarchy.
 - Renamed ConnectedProcess to ConnectedUnixProcess (there could
   be versions for other OS environments in the future).
 - Refactored OSProcess hierarchy to include external process classes.
 - No modifications required for sqXWindow.c (Squeak 2.8 Unix VM
   or newer). Support code is now included in the normal
   sqXWindow.c. In most cases, it should be possible to compile a
   UnixOSProcessAccessor.so module without recompiling the VM.
 - Added a signal handler for sigpipe to prevent VM exit when reading
   an expired pipe.
 - Updated dependents when runState changes in an
   ExternalUnixProcess.
 - Added UnixProcess>>getCWD method (per Lex Spoon)
 - Fixed environment setting code to use static allocated environment
   strings (not object memory, which can move and invalidate the
   environment)
 - Fixed signal sending bug (bad use of isIntegerObject caused signals
   to work only on odd numbered pids)
 - Added signal sending methods to UnixProcess (send signal to child) and
   ExternalUnixProcess (send signal to external process which it represents).

Changes in 1.1 since 0.4:
 - Modifications no longer required for Squeak header files (a modified
   version of Ian's sqXWindow.c is still required).

Building the plugin:
 - Start with a copy of Ian's Squeak VM code.
 - If you are using version 2.7 or earlier VM source, add the modified
   sqXWindow.c. For version 2.8 and later, this is not necessary.
 - Recompile the VM (may be optional for version 2.8 or later).
 - Start Squeak. If you have been using a previous version of
   OSProcess, delete (or rename) the UnixOSProcessAccessor.so module
   first, because changing either the module or the Smalltalk code
   which refers to it can crash a running Squeak system.
 - If an earlier version of OSProcess is in your image, delete it.
 - Load the change set into Squeak. The C code for the plugin
   (UnixOSProcessAccessor.c) will be created in your Squeak directory.
 - Make a directory called 'UnixOSProcessAccessor' in your source
   tree. Copy (or symbolic link) UnixOSProcessAccessor.c into this directory.
 - Build new VM and plugins (reconfigure, make, and make plugins).
 - Move the new VM and UnixOSProcessAccessor.so module into their
   proper directories, and restart Squeak.
 - See the examples in class OSProcess, class UnixProcess, and class
   ShellWindow. See also the utilities category in class UnixProcess."

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OSProcessV1-2.1.cs.gz
Type: application/x-gunzip
Size: 30303 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20000715/19886e3e/OSProcessV1-2.1.cs.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UnixOSProcessAccessor.c.gz
Type: application/x-gunzip
Size: 5181 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20000715/19886e3e/UnixOSProcessAccessor.c.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LinuxPlugin.tar.gz
Type: application/x-tar-gz
Size: 24792 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20000715/19886e3e/LinuxPlugin.tar.bin


More information about the Squeak-dev mailing list