*Mview management of exec for virtual files

From Virtualsquare
Revision as of 19:36, 27 December 2012 by Renzo (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

execvp needs a file in the file system. When the file is a virtual file there is no way to feed the file to execvp. The basic idea is to create a temporary copy of the executable file and then execvp it instead of the virtual file.

The support for exec is in um_exec.c.

There is also the binfmt support that needs to execute an interpreter for the executable instead of the executable, and the interpreter can be a virtual file, too.

Let us first consider the case of standard executables (without binfmt, see the wrap_in_execve, at the end, the else branch of if (binfmtser != UM_NONE)).

When the file is virtual (and the module does not need to give a specific implementation of execve) the executable is copied (function filecopy) and the executed. The virtual file temporary copy file will be deleted at the next system call executed by the same process (thus execve will be completed at that time).

When binfmt need to start an interpreter for the executable, *mview executes a wrapper named umbinwrap instead of the executable. umbinwrap encodes in argv[0] the path of the interpreter, the path of the executable and when binfmt needs it the former argv[0].

The wrapper decodes argv[0] and starts the interpreter, working as a standard process under the control of *mview. umbinwrap uses execvp to start the interpreter thus it could be a virtual file or even a further interpreter, but um_exec can cope with both cases.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox