lxcfs/0004-lxcfs-fix-cpuinfo-print.patch
wangkang101 c4b0d62eb5 update to 4.0.5
Signed-off-by: wangkang101 <873229877@qq.com>
2020-08-29 17:37:34 +08:00

24 lines
894 B
Diff

diff --git a/src/proc_cpuview.c b/src/proc_cpuview.c
index 7d6c0bd..3311c27 100644
--- a/src/proc_cpuview.c
+++ b/src/proc_cpuview.c
@@ -952,7 +952,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 (l >= cache_size)