fix(syscall): 修复 sysinfo 系统调用未填充关键字段的问题 #1630
Closed
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.
概述
修复了 sysinfo 系统调用的 3 个关键字段未正确填充的问题,导致 gvisor 测试失败。
主要修改
1. uptime 字段
使用
clock() / HZ计算系统运行时间(秒)uptime = 0uptime = clock() / HZ2. procs 字段
使用
ProcessManager::get_all_processes()统计进程数procs = 0procs = ProcessManager::get_all_processes().len() as u163. mem_unit 字段
设为 1(字节单位)
mem_unit = 0mem_unit = 1测试验证
影响范围
kernel/src/syscall/misc.rs: sysinfo 系统调用实现(6 行修改)user/apps/r_unitest/src/bin/test_sysinfo.rs: 新增单元测试(206 行)相关 Issue
解决 gvisor sysinfo 测试失败问题