rCore-Tutorial-Book-v3
rCore-Tutorial-Book-v3 copied to clipboard
rCore-Tutorial-Book-v3/chapter7/1file-descriptor
基于文件的标准输入/输出 - rCore-Tutorial-Book-v3 3.6.0-alpha.1 文档
https://rcore-os.cn/rCore-Tutorial-Book-v3/chapter7/1file-descriptor.html
操作系统并并不会阻止这样的事情发生。-> 操作系统并不会阻止这样的事情发生。
// copy fd table
let mut new_fd_table: Vec<Option<Arc<dyn File + Send + Sync>>> = Vec::new();
for fd in parent_inner.fd_table.iter() {
if let Some(file) = fd {
new_fd_table.push(Some(file.clone()));
} else {
new_fd_table.push(None);
}
}
请问这里为什么不直接 let new_fd_table = parent_inner.fd_table.clone() ?