lxcfs/0005-lxcfs-fix-cpuinfo-print.patch
2019-11-06 19:42:23 +08:00

24 lines
865 B
Diff

diff -uprN a/bindings.c b/bindings.c
--- a/bindings.c 2018-08-16 09:36:58.751107328 +0800
+++ b/bindings.c 2018-08-16 10:02:12.719191680 +0800
@@ -3471,7 +3471,17 @@ static int proc_cpuinfo_read(char *buf,
}
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) {
perror("Error writing to cache");
rv = 0;