uname -m的可能值 [英] Possible values for `uname -m`

查看:679
本文介绍了uname -m的可能值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

uname(1) 命令行实用程序有一个-m选项,用于打印机器硬件名称".

The uname(1) command-line utility has a -m option which prints the "machine hardware name".

在Linux上,此字段来自struct utsnamemachine成员,由

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:

机器"字段的可能值是什么?

推荐答案

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_MACHINEMakefile中的默认值与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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆