Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!rbj From: rbj@uunet.UU.NET (Root Boy Jim) Newsgroups: comp.unix.wizards Subject: Re: Message-ID: <118868@uunet.UU.NET> Date: 18 Jan 91 21:51:26 GMT References: <1991Jan15.204849@IASTATE.EDU> Organization: UUNET Communications Services, Falls Church, VA Lines: 78 In <1991Jan15.204849@IASTATE.EDU> spam@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@iastate.edu -- Root Boy Jim Cottrell Close the gap of the dark year in between