<None>

Root Boy Jim rbj at uunet.UU.NET
Sat Jan 19 08:51:26 AEST 1991


In <1991Jan15.204849 at IASTATE.EDU> spam at IASTATE.EDU (Begley Michael L) writes:
>Here's a question that a few people have answered "That's impossible".

I disagree. See below.

>It probably is, but it seems that *philosophically* it should be possible...

Maybe, but just because it's possible doesn't mean you should do it.

>What I'd like to do is execute a stream.  The specific application I
>have in mind is to compress all my executables, then execute them from
>a simple shell script. Something like:
>
>   uncompress -c microemacs|execute   /* uncompress microemacs.Z     */
>                                      /* into a stream, and execute  */
>
>would automagically run a compressed copy of Microemacs.

I once suggested to Chris Torek that the kernel should execute
compressed programs. He groaned.

>  I know that something like:
>   uncompress microemacs  >temp       /*uncompress into temp */

You mean zcat.

>   temp                               /*run the uncompressed version */
>   rm temp                            /*and remove the file  */
>
>but that seems inelegant; kludgy, almost VMS-like!

Harumph! What it is is LISP like. I once had three scripts called
load, unload, and autoload, which went something like this:

	#! /bin/csh -f
	# load pathname
	set DIR=`dirname $1`
	set FILE=`basename $1`
	rm $1
	mv $DIR/Z/$FILE.Z $1.Z
	exec uncompress $1


	#! /bin/csh -f
	# unload pathname
	set DIR=`dirname $1`
	set FILE=`basename $1`
	mv $1 $DIR/Z
	ln -s $1 /usr/local/bin/autoload
	exec compress $DIR/Z/$1

	#! /bin/csh -f
	# autoload a program and execute it
	# real programs are symlinked to autoload
	load $0
	exec $0 $*

Load & unload were suid. A tad insecure, but you could write wrappers.
I am also typing this from memory; there were other features too.

I unloaded most everything in /usr/bin.

>I've been told that it can't be done because of swapping...

Now if you wanted to do it online, you'd have to use a 407 (ld -N) file.
You would do what all good boot programs do: copy the text and data to
the right place, then jump to the start address. Royal pain.

>Can anyone help?

No. It's too hard to do right and so easy to do half assed.

>-mike begley
>spam at iastate.edu
-- 

	Root Boy Jim Cottrell <rbj at uunet.uu.net>
	Close the gap of the dark year in between



More information about the Comp.unix.wizards mailing list