|This article needs additional citations for verification. (September 2009)|
The executable formats are registered through a special purpose file system interface (similar to /proc). Debian-based distributions provide the functionality through an extra binfmt-support package.
The register file contains lines which define executable types to be handled. Each line is of the form:
- name is the name of the binary format.
- type is either E or M
- If it is E, the executable file format is identified by its filename extension: magic is the file extension to be associated with the binary format; offset and mask are ignored.
- If it is M, the format is identified by magic number at an absolute offset in the file and mask is a bitmask indicating which bits in the number are significant.
- interpreter is a program that is to be run with the matching file as an argument.
Each format has a corresponding file entry in the /proc/sys/fs/binfmt_misc directory which can be read to get information about a given file format.
Another common usage is to execute PE executables (compiled for MS-DOS or Microsoft Windows) through Wine. For example, the following line will run DOS and Windows EXE files (identified by the "MZ" type code) using Wine:
- Documentation/binfmt_misc.txt in the Linux kernel source tree
- Guide:Running Mono Applications