Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!olivea!apple!veritas!craig From: craig@Veritas.COM (Craig Harmer) Newsgroups: comp.unix.internals Subject: Re: executing a stream Summary: its a philosophical question Message-ID: <1991Jan17.230854.19606@Veritas.COM> Date: 17 Jan 91 23:08:54 GMT References: <141325@pyramid.pyramid.com> <1991Jan17.062934.10863@Think.COM> Sender: craig@veritas.com Followup-To: comp.unix.wizards Organization: Veritas Software Lines: 35 In article <1991Jan17.062934.10863@Think.COM> barmar@think.com (Barry Margolin) writes: >In article <141325@pyramid.pyramid.com> moliver@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@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]