uname -m的可能值 [英] Possible values for `uname -m`
问题描述
uname(1)
命令行实用程序有一个-m
选项,用于打印机器硬件名称".
The uname(1)
command-line utility has a -m
option which prints the "machine hardware name".
在Linux上,此字段来自struct utsname
的machine
成员,由
On Linux, this field comes from the machine
member of struct utsname
, as populated by the uname(2)
system call.
许多其他语言的API返回此信息:
Many other language APIs return this information:
- Python:
os.uname()
和platform.machine()
- PHP:
php_uname()
机器"字段的可能值是什么?
推荐答案
Linux
(v4.12-2017年7月)
Linux
(v4.12 - 2017-July)
让我们参考 newuname的来源系统调用.
由于Linux具有 UTS命名空间,因此对此进行跟踪很复杂,但是 init_uts_ns
machine
字段由UTS_MACHINE
宏初始化,该宏是按体系结构定义的.
Tracking this down is complicated by the fact that Linux has UTS namespaces, but the init_uts_ns
machine
field is initialized by the UTS_MACHINE
macro, which is defined per-architecture.
更复杂的问题是,可以通过COMPAT_UTS_MACHINE.
Further complicating matters, machine
can be overridden via override_architecture()
, if the process is running under a 32-bit "compat" personality, to COMPAT_UTS_MACHINE
.
UTS_MACHINE
在Makefile
中的默认值与ARCH
相同.但是,许多平台在同一arch
目录下具有单独的子体系结构,因此它们自己设置UTS_MACHINE
UTS_MACHINE
defaults in Makefile
to the same thing as ARCH
. However, many platforms have separate sub-architectures under the same arch
directory, so they set UTS_MACHINE
themselves
使用arch/
中的目录列表以及Linux内核源代码(git grep 'UTS_MACHINE\s*:='
和git grep COMPAT_UTS_MACHINE
)的grep
-ing,我们可以找到此列表:
With the list of directories in arch/
and a little grep
-ing of the Linux kernel sources (git grep 'UTS_MACHINE\s*:='
and git grep COMPAT_UTS_MACHINE
), we can arrive at this list:
-
alpha
-
arc
arm
armv8l
(arm64
兼容)
blackfin
这篇关于uname -m的可能值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!