summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2024-03-23 14:53:21 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2024-03-23 13:05:11 +0100
commite652799da09e4bade166476ad4cee13e49722ec9 (patch)
treeb58250fed8de3e5ce7b9efeee254ceaa39fd5b8a
parentbbb662f012ca16c53f93d9de32872a9229c87769 (diff)
proc: Add support for AArch64 in uname
Since no CPU subtypes are defined for CPU_TYPE_ARM64, just report the type, same as for x86_64. Sample uname(2) output: sysname: GNU release: 0.9 version: GNU-Mach 1.8/Hurd-0.9 machine: aarch64 Message-ID: <20240323115322.69075-9-bugaevc@gmail.com>
-rw-r--r--proc/cpu-types.c3
-rw-r--r--proc/host.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/proc/cpu-types.c b/proc/cpu-types.c
index 3d89d5a7..41af0888 100644
--- a/proc/cpu-types.c
+++ b/proc/cpu-types.c
@@ -36,6 +36,9 @@ const char *const mach_cpu_types[] =
#ifdef CPU_TYPE_X86_64
[CPU_TYPE_X86_64] = "x86_64",
#endif
+#ifdef CPU_TYPE_ARM64
+ [CPU_TYPE_ARM64] = "aarch64",
+#endif
};
const char *const mach_cpu_subtypes[][32] =
diff --git a/proc/host.c b/proc/host.c
index 0197fecf..e0aff20a 100644
--- a/proc/host.c
+++ b/proc/host.c
@@ -355,11 +355,11 @@ initialize_version_info (void)
assert_backtrace (! err);
snprintf (uname_info.machine, sizeof uname_info.machine,
"%s"
-#ifndef __x86_64__
+#if !defined (__x86_64__) && !defined (__aarch64__)
"-%s"
#endif
, mach_cpu_types[info.cpu_type]
-#ifndef __x86_64__
+#if !defined (__x86_64__) && !defined (__aarch64__)
, mach_cpu_subtypes[info.cpu_type][info.cpu_subtype]
#endif
);