1 Star 0 Fork 25

hd_zhoujie/procps-ng

forked from src-openEuler/procps-ng 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-0001-ps-address-missing-or-corrupted-fields-with-m-option.patch 1.79 KB
一键复制 编辑 原始数据 按行查看 历史
hd_zhoujie 提交于 2023-05-30 20:05 . fix ps -lm dump problem
From 35dc38cb7fcfb71b151a020abb16197b88370337 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 24 May 2023 00:00:00 -0500
Subject: [PATCH 1/3] ps: address missing or corrupted fields with -m option
Coincidentally, a Debian bug report and a gitlab issue
were raised at nearly the same time and are referenced
below. They both dealt with that '-m' (thread) option.
That option forces tasks and their threads to be shown
on separate lines. Also, information may be suppressed
between that main process and any lightweight process.
The bottom line was sometimes a required pids_item may
not have been requested from the library before trying
to display a result. For the best case, some incorrect
results might be shown. However, in the worst case (as
with PIDS_WCHAN_NAME) a segmentation fault is created.
[ After addressing the '-m' option problems, another ]
[ issue was found with that '-F' (extra full format) ]
[ option. The PSR (processor) field was always zero. ]
[ It was addressed in a similar manner to the above. ]
Reference(s):
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1036631
https://gitlab.com/procps-ng/procps/-/issues/279
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
src/ps/display.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/ps/display.c b/src/ps/display.c
index 4207cf87..46ac844f 100644
--- a/src/ps/display.c
+++ b/src/ps/display.c
@@ -600,6 +600,13 @@ static void finalize_stacks (void)
// special items with 'extra' used as former pcpu
chkREL(extra)
chkREL(noop)
+ // lastly, any remaining needs ...
+ if (format_flags & FF_Uf)
+ chkREL(PROCESSOR);
+ if (thread_flags & TF_U_m) {
+ chkREL(PRIORITY);
+ chkREL(WCHAN_NAME);
+ }
// now accommodate any results not yet satisfied
f_node = format_list;
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hd-zhoujie/procps-ng.git
git@gitee.com:hd-zhoujie/procps-ng.git
hd-zhoujie
procps-ng
procps-ng
master

搜索帮助