- Binfmt misc
binfmt_misc is a capability of the
Linux kernel which allows arbitraryexecutable file format s to be recognized and passed to certainuser space applications, such asemulator s andvirtual machine s.The executable formats are registered through a
special purpose file system interface (similar to/proc ).Registration
The register file contains lines which define executable types to be handled. Each line is of the form:
:name:type:offset:magic:mask:interpreter:
* name is the name of the new binary format.
* type is either E or M. If it is E, then the executable file format is identified by itsfilename extension , offset and mask are ignored, and magic is the file extension to be associated with the binary format. If it is M, then the executable file format is identified by a magic number near the beginning of the file. magic is the magic number identifying the binary format and offset is the offset at which the magic number is found in the file. The mask isbitwise AND ed with the magic string from the file: the bits which are unset in the mask are ignored in the comparison to the magic.
* interpreter is a path to an executable. When a file using a binfmt_misc-registered executable format is executed, this program is run with the executable as an argument.When an executable file format is registered, a file is created in the /proc/sys/fs/binfmt_misc directory. This file can be read later to get information about the file format.
Common usage
binfmt_misc allows Java programs to be passed directly to the
Java virtual machine .Another common usage is to execute
PE executable s (compiled forMS-DOS orMicrosoft Windows ) through Wine. For example, the following line will run DOS and WindowsEXE files (identified by the "MZ"type code ) using Wine::DOSWin:M::MZ::/usr/bin/wine:
See also
*
Shebang (Unix) References
* [http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/binfmt_misc.txt;hb=HEAD Documentation/binfmt_misc.txt] in the Linux kernel source tree
External links
* [http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html Project home page]
Wikimedia Foundation. 2010.