lxcfs/0004-lxcfs-fix-cpuinfo-print.patch
vegbir 6ad912e044 update to 4.0.11
(cherry picked from commit 333138af7dd63430c46198dcb24abdcf5cc43b98)
2021-12-17 10:03:03 +08:00

36 lines
1.2 KiB
Diff

From 1901edf2908551cf862f3deabf23acbda55d2dea Mon Sep 17 00:00:00 2001
From: yangjiaqi <yangjiaqi16@huawei.com>
Date: Thu, 25 Nov 2021 11:52:05 +0800
Subject: [PATCH 04/17] lxcfs-fix-cpuinfo-print
---
src/proc_cpuview.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/proc_cpuview.c b/src/proc_cpuview.c
index 9f6a55e..75006a6 100644
--- a/src/proc_cpuview.c
+++ b/src/proc_cpuview.c
@@ -970,7 +970,17 @@ int proc_cpuinfo_read(char *buf, size_t size, off_t offset,
}
if (am_printing) {
- l = snprintf(cache, cache_size, "%s", line);
+ if (strncmp(line, "physical id", 11) == 0) {
+ l = snprintf(cache, cache_size, "physical id : %d\n", curcpu);
+ } else if (strncmp(line, "siblings", 8) == 0) {
+ l = snprintf(cache, cache_size, "siblings : 1\n");
+ } else if (strncmp(line, "core id", 7) == 0) {
+ l = snprintf(cache, cache_size, "core id : 0\n");
+ } else if (strncmp(line, "cpu cores", 9) == 0) {
+ l = snprintf(cache, cache_size, "cpu cores : 1\n");
+ } else {
+ l = snprintf(cache, cache_size, "%s", line);
+ }
if (l < 0)
return log_error(0, "Failed to write cache");
if ((size_t)l >= cache_size)
--
2.27.0