Running Unix programs under LispOS

cwg@DeepEddy.Com cwg@DeepEddy.Com
Fri, 02 May 1997 01:20:13 -0500

Content-Type: text/plain; charset=us-ascii

I was thinking that there are basically two reasons we would want to run Unix/
C programs under LispOS:

1)  To make use of existing lowlevel code such as drivers, network code, a 
scheduler, etc...  Eventually we'd like to eliminate most of this and replace 
it with lisp code "all the way down".

2)  To run existing applications within our environment so we don't have to 
reimplement everything from tar to netscape.

I may be talking through my hat here, but it seems plausible to me to support 
a mini-unix environment *within* our lisp universe, but keep it isolated from 
the world that we're running.  What I imagine is a subsystem which can run ELF 
binaries in their own protected memory.  You might write lisp code that looks 
something like this:

(let ((browser (find-elf-binary "netscape"))
   (funcall browser "")))

or maybe:

(let ((tar (find-elf-binary "tar"))
      (*standard-io* (make-instance 'terminal))
      (unix-env::pwd "/usr/local/src"))
   (funcall tar "-xvf" "/usr/local/src/tarfiles/foo.tar"))

I might define this:

(defun ed (file)
   (funcall (find-elf-binary "emacs") file))

and someone sick might define this:

(defun ed (file)
   (let* ((*standard-io* (make-instance 'terminal))
          (unix-env::term (termtype *standard-io*)))
      (funcall (find-elf-binary "vi") file)))

Basically, there would be an object which contains enough Unix environment to 
run an elf binary.  This environment could be controlled from the lisp world, 
but the Unix program would think it's on a real Unix machine.  If a Unix 
program forked itself, it would create a new object for the child.  The 
scheduler would be handled in Lisp (or at a lower level until we got a working 

Conceptually, this would be fairly easy to implement while there was a full 
version of Linux sitting on the hard disk.  Initially, the LispOS might just 
appear like a shell under Linux, but the next phase would be to replace the 
stuff between the kernel and the shell with Lisp code, and finally the only 
Unix left would be the code running in these isolated environments (and all 
the /usr/include, /usr/lib, and so on that it needs.

In practice could this be as simple as the concept sounds to me?

I could also see running DOS or Windows binaries in a similar fashion.


Chris Garrigues                    O-              cwg@DeepEddy.Com
  Deep Eddy Internet Consulting                     +1 512 432 4046
  609 Deep Eddy Avenue
  Austin, TX  78703-4513              http://www.DeepEddy.Com/~cwg/

Content-Type: application/pgp-signature

Version: 2.6.2