rCore-Tutorial-Book-v3 icon indicating copy to clipboard operation
rCore-Tutorial-Book-v3 copied to clipboard

rCore-Tutorial-Book-v3/chapter7/1file-descriptor

Open utterances-bot opened this issue 1 year ago • 2 comments

基于文件的标准输入/输出 - rCore-Tutorial-Book-v3 3.6.0-alpha.1 文档

https://rcore-os.cn/rCore-Tutorial-Book-v3/chapter7/1file-descriptor.html

utterances-bot avatar Oct 21 '24 08:10 utterances-bot

操作系统并并不会阻止这样的事情发生。-> 操作系统并不会阻止这样的事情发生。

FunCheney avatar Oct 21 '24 08:10 FunCheney

        // 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() ?

uchouT avatar Nov 24 '25 06:11 uchouT