Repository navigation
fix(syscall-stat): handle -t/--top option instead of rejecting it - #161
Open
yuKing123-king wants to merge 1 commit into
Open
yuKing123-king wants to merge 1 commit into
yuKing123-king wants to merge 1 commit into
Conversation
Signed-off-by: Wang Yu <wangyu6@uniontech.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复的 Bug
syscall-stat的-t/--top功能完全不可用:传入-t会被当作非法选项拒绝并退出。根因:
parse_args()的 switch(syscall-stat.cpp:164-197)只有p/f/c/i/h/default,缺少case 't':。-t被getopt_long正确识别并返回't',但 switch 里没有对应分支,落到default→Usage()+exit(-1)。讽刺的是,该功能的所有其它部分都已就绪:
{"top", no_argument, 0, 't'}(syscall-stat.cpp:80)static bool top = false(syscall-stat.cpp:72)timer_task里if (top) { printf("\33[H\33[2J\33[3J"); ... }清屏输出(syscall-stat.cpp:320-324){"[top]", "output information in top way\n"}(syscall-stat.cpp:98)唯独
parse_args的 switch 漏了case 't'这一行,导致整条链路断在入口处。改了哪些地方
仅
observe/syscall-stat.cpp的parse_argsswitch 内新增一个 case:插入在
case 'i':与case 'h':之间。不涉及 BPF 侧、不涉及timer_task逻辑、不涉及选项表。