1 Star 0 Fork 50

池鱼/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0286-execute-dump-CPUAffinity-as-a-range-string-instead-o.patch 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-01-20 13:59 . import systemd-239-29.el8.src.rpm
From b90f935f8d2268522480a7c12f7e2213a7a5e19d Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Fri, 31 May 2019 18:02:20 +0200
Subject: [PATCH] execute: dump CPUAffinity as a range string instead of a list
of CPUs
We do this already when printing the property in systemctl so be
consistent and do the same for systemd-analyze dump.
(cherry picked from commit e7fca352ba43988682a927de6b1f629b3f10a415)
Related: #1734787
---
src/core/execute.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/core/execute.c b/src/core/execute.c
index 22e5825905..bc26aa66e7 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -4098,11 +4098,10 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
}
if (c->cpu_set.set) {
- fprintf(f, "%sCPUAffinity:", prefix);
- for (i = 0; i < c->cpu_set.allocated * 8; i++)
- if (CPU_ISSET_S(i, c->cpu_set.allocated, c->cpu_set.set))
- fprintf(f, " %u", i);
- fputs("\n", f);
+ _cleanup_free_ char *affinity = NULL;
+
+ affinity = cpu_set_to_range_string(&c->cpu_set);
+ fprintf(f, "%sCPUAffinity: %s\n", prefix, affinity);
}
if (c->timer_slack_nsec != NSEC_INFINITY)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zxy19951122/systemd.git
git@gitee.com:zxy19951122/systemd.git
zxy19951122
systemd
systemd
a8

搜索帮助