Re: Executing memory mapped files

Brian Raiter <[email protected]>
Newsgroups org.kernel.vger.linux-assembly
Message-ID <[email protected]>
> Is it possible to load an executable binary (8k) into memory using mmap()
> function ant then executing the binary program in memory.

If by executable binary, you mean an ELF binary, then no, it wouldn't
be easy. (Obviously, it's *possible*, because that's exactly what
Linux does when you run a program.) You'd have to replicate all of the
program-loading processes that the kernel does for you.

The answer is to just use an exec function to run the program file
directly. There's no point in trying to mmap() it first (and in fact
the kernel will undoubtedly use mmap in the process of loading it).

b
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.