executing a stream

Craig Harmer craig at Veritas.COM
Fri Jan 18 10:08:54 AEST 1991


In article <1991Jan17.062934.10863 at Think.COM> barmar at think.com (Barry Margolin) writes:
>In article <141325 at pyramid.pyramid.com> moliver at shadow.pyramid.com (Mike Oliver) writes:
>>Why not just create a file under /tmp (say, /tmp/executable.$$), copy
>>from stdin into that file, then on feof(stdin) simply close() the file
>>and exec() it.
>
>I guess I trimmed the original article too much, as yours is the second
>response I've seen that said this.  The original poster (who,
>unfortunately, didn't put a "Subject" line in his message, so readers may
>be having trouble finding it) mentioned this, but dismissed it as
>distasteful.  Personally, I think it's better than my ptrace-based
>solution, as it is really simple and completely portable; in fact, I was
>sort of hoping that my description of the complexity of implementing it
>without a temp file would cause him to accept the temp-file solution.

actually, i think the question was basically philospohical.  to rephrase
it, it would be "why isn't an executable a stream of bytes?", or
"why does an executable need to be a file on disk with magic numbers,
structure, and all that stuff?"

the proposed solutions are to copy the executable to a file, and exec it,
or to duplicate the functionality of exec(), with the ability to run off
a memory image.  why, for example, shouldn't we be able to create a named
pipe, send the file to it, and execute that?

i suppose the answer is that a machine executable is an application, and
the kernel is the interpreter, in the same sense that the shell is an
interpreter for shell scripts.  the kernel (as interpreter) won't work
on a stream of bytes.

-- 
{apple,pyramid,amdahl}!veritas!craig			craig at hoser.veritas.com
(415) 626-6827 (h)					(408) 433-5588 x220 (w)
	[views expressed above shouldn't be taken as 
	Veritas' views, or your views or even as my views]



More information about the Comp.unix.internals mailing list