-
-
Notifications
You must be signed in to change notification settings - Fork 169
fix(syscall): 修复一些系统调用 #1622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(syscall): 修复一些系统调用 #1622
Conversation
|
bugbot run |
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3284ad11b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
feat(time): 增加系统启动时间和运行时间的计算 fix(process): 添加获取当前进程数量的函数
|
bugbot run |
|
Skipping Bugbot: Unable to authenticate your request. Please make sure Bugbot is properly installed and configured for this repository. |
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52d659b36a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #[derive(Debug, Default, Copy, Clone)] | ||
| #[repr(C)] | ||
| pub struct SysInfo { | ||
| uptime: u64, | ||
| loads: [u64; 3], | ||
| totalram: u64, | ||
| freeram: u64, | ||
| sharedram: u64, | ||
| bufferram: u64, | ||
| totalswap: u64, | ||
| freeswap: u64, | ||
| procs: u16, | ||
| pad: u16, | ||
| totalhigh: u64, | ||
| freehigh: u64, | ||
| mem_unit: u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是给用户态的结构体,如果外面用不到,就不用pub。 并且要以PosixSysInfo这样命名,以便跟内核其他系统调用的命名规则一致。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可是sysinfo不是posix标准的系统调用呀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可是sysinfo不是posix标准的系统调用呀
这里的Posix的意思指的是对齐Linux的面向用户态的结构体。避免内核态把他混淆使用。
kernel/src/syscall/sys_sysinfo.rs
Outdated
| sysinfo.freehigh = 0; | ||
| sysinfo.mem_unit = 1; | ||
|
|
||
| writer.copy_one_to_user(&sysinfo, 0)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
要使用基于异常表保护的版本
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UserBuffer 中有基于异常表保护拷贝实现的 write_one<T>() ,可以考虑使用这个。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
详情请看这个 Project: [Security] User Access 补完 。
对应以下三个 issue需要完成:
- # 1590 CORE-326
- refactor: Using
UserBufferto obtain user-mode data in the general system calls #1593 CORE-328 - feat: 实现
user_access::get_user()用于基本类型、带异常的用户态变量拷贝 #1588 CORE-325
后面有空应该要集中重构。
fix(timekeeping): 优化时间初始化逻辑,移除不必要的调试信息
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样设置不对8。 墙上时间的更新我理解应该是update_walltime 的职责? 在update_walltime以外的地方,直接去改xtime的值我觉得应该是不合理的。因为时间子系统有自己的一套机制去更新这个。
我理解你这里的需求是计算系统自启动以来的时间?那直接Instant::now不就好了。在LATE的时间点,时间子系统都已经工作了。
| #[derive(Debug, Default, Copy, Clone)] | ||
| #[repr(C)] | ||
| pub struct SysInfo { | ||
| uptime: u64, | ||
| loads: [u64; 3], | ||
| totalram: u64, | ||
| freeram: u64, | ||
| sharedram: u64, | ||
| bufferram: u64, | ||
| totalswap: u64, | ||
| freeswap: u64, | ||
| procs: u16, | ||
| pad: u16, | ||
| totalhigh: u64, | ||
| freehigh: u64, | ||
| mem_unit: u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可是sysinfo不是posix标准的系统调用呀
这里的Posix的意思指的是对齐Linux的面向用户态的结构体。避免内核态把他混淆使用。
kernel/src/process/mod.rs
Outdated
| /// 获取当前 PID namespace 中的进程数量 | ||
| pub fn ns_process_count() -> usize { | ||
| Self::current_pcb().active_pid_ns().pid_allocated() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数就那个地方用到,我理解直接ProcessManager::current_pidns().pid_allocated()这样比较好。应当在pidns那边impl一个current_pidns()而不是这里这个ns_process_count()

Uh oh!
There was an error while loading. Please reload this page.