Skip to content

Commit 11300a5

Browse files
author
cyh21
committed
2025-4-14v2
1 parent f9d5e04 commit 11300a5

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

docs/日报/2025-4-5.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@
55
1. 为taskext添加文件数量限制,初始化为AX_FILE_LIMIT(1024),和arceos保持一致
66
2. 修改sys_dup当返回的fd大于限制时,close该fd,返回错误码
77

8+
```rust
9+
pub struct TaskExt {
10+
......
11+
/// The limit of fd
12+
pub fd_limit: AtomicU64,
13+
}
14+
15+
pub fn sys_dup(old_fd: c_int) -> LinuxResult<isize> {
16+
// Ok(api::sys_dup(old_fd) as _)
17+
let new_fd = api::sys_dup(old_fd);
18+
if new_fd >= current().task_ext().get_fd_limit() as _ {
19+
return Err(axerrno::LinuxError::EMFILE);
20+
}
21+
Ok(new_fd as _)
22+
}
23+
```
24+
825
![alt text](image-16.png)
926

1027
## 实现sysinfo

0 commit comments

Comments
 (0)