[RFC PATCH 4/9] um: change machine name for uname output
Johannes Berg
johannes at sipsolutions.net
Mon Jul 20 11:26:54 PDT 2026
From: Hajime Tazaki <thehajime at gmail.com>
This commit tries to display MMU/!MMU mode from the output of uname(2)
so that users can distinguish which mode of UML is running right now.
Signed-off-by: Hajime Tazaki <thehajime at gmail.com>
Link: https://patch.msgid.link/62314a61fd98febda7aafaa746f00eb0b16d1180.1770170302.git.thehajime@gmail.com
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
arch/um/Makefile | 6 ++++++
arch/um/os-Linux/util.c | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 937639edc295..1f85b73d4abb 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -148,6 +148,12 @@ export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) $(CC_FLAGS_
CLEAN_FILES += linux x.i gmon.out
MRPROPER_FILES += $(HOST_DIR)/include/generated
+ifeq ($(CONFIG_MMU),y)
+UTS_MACHINE := "um"
+else
+UTS_MACHINE := "um\(nommu\)"
+endif
+
archclean:
@find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
-o -name '*.gcov' \) -type f -print | xargs rm -f
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index e3ad71a0d13c..5fb26f5dfcb6 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -64,7 +64,8 @@ void setup_machinename(char *machine_out)
}
# endif
#endif
- strcpy(machine_out, host.machine);
+ strcat(machine_out, "/");
+ strcat(machine_out, host.machine);
}
void setup_hostinfo(char *buf, int len)
--
2.53.0
More information about the linux-um
mailing list