file_architecture


Description:

[ Version ( since = "1.5.3" ) ]
public string file_architecture (string filename) throws Error

detect the architecture of a binary file

This detects the architecture of the binary filename, and returns it if known.

Currently defined architectures are:

"aarch64" 64 bit ARM.

"arm" 32 bit ARM.

"i386" This string is returned for all 32 bit i386, i486, i586, i686 binaries irrespective of the precise processor requirements of the binary.

"ia64" Intel Itanium.

"ppc" 32 bit Power PC.

"ppc64" 64 bit Power PC (big endian).

"ppc64le" 64 bit Power PC (little endian).

"riscv32" "riscv64" "riscv128" RISC-V 32-, 64- or 128-bit variants.

"s390" 31 bit IBM S/390.

"s390x" 64 bit IBM S/390.

"sparc" 32 bit SPARC.

"sparc64" 64 bit SPARC V9 and above.

"x86_64" 64 bit x86-64.

Libguestfs may return other architecture strings in future.

The function works on at least the following types of files:

* many types of Un*x and Linux binary

* many types of Un*x and Linux shared library

* Windows Win32 and Win64 binaries

* Windows Win32 and Win64 DLLs

Win32 binaries and DLLs return i386.

Win64 binaries and DLLs return x86_64.

* Linux kernel modules

* Linux new-style initrd images

* some non-x86 Linux vmlinuz kernels

What it can't do currently:

* static libraries (libfoo.a)

* Linux old-style initrd as compressed ext2 filesystem (RHEL 3)

* x86 Linux vmlinuz kernels

x86 vmlinuz images (bzImage format) consist of a mix of 16-, 32- and compressed code, and are horribly hard to unpack. If you want to find the architecture of a kernel, use the architecture of the associated initrd or kernel module(s) instead.

Parameters:

this

A GuestfsSession object

Returns:

the returned string, or NULL on error