Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/arceos_posix_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ axns = { workspace = true, optional = true }
# Other crates
axio = "0.1"
axerrno = "0.1"
flatten_objects = "0.2"
flatten_objects = { git = "https://github.com/arceos-org/flatten_objects.git", rev = "8da6573" }
static_assertions = "1.1.0"
spin = { version = "0.9" }
lazy_static = { version = "1.5", features = ["spin_no_std"] }
ctor_bare = "0.2"

[build-dependencies]
bindgen ={ version = "0.69" }
bindgen = { version = "0.69" }
5 changes: 2 additions & 3 deletions api/arceos_posix_api/src/imp/fd_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ impl FD_TABLE {
pub fn copy_inner(&self) -> RwLock<FlattenObjects<Arc<dyn FileLike>, AX_FILE_LIMIT>> {
let table = self.read();
let mut new_table = FlattenObjects::new();
let count = table.count();
for i in 0..count {
let _ = new_table.add_at(i, table.get(i).unwrap().clone());
for id in table.ids() {
let _ = new_table.add_at(id, table.get(id).unwrap().clone());
}
RwLock::new(new_table)
}
Expand Down
12 changes: 0 additions & 12 deletions api/arceos_posix_api/src/imp/path_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use alloc::string::{String, ToString};
use axerrno::{AxError, AxResult};
use axfs::api::{canonicalize, current_dir};

use super::fd_ops::FD_TABLE;

/// 一个规范化的文件路径表示
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug)]
pub struct FilePath(String);
Expand Down Expand Up @@ -343,22 +341,12 @@ fn handle_empty_path(dir_fd: isize) -> AxResult<String> {
return Ok(String::from("."));
}

let fd_table = FD_TABLE.write();
if dir_fd >= fd_table.count() as isize || dir_fd < 0 {
axlog::warn!("文件描述符索引超出范围");
return Err(AxError::InvalidInput);
}
super::fs::Directory::from_fd(dir_fd as i32)
.map(|dir| dir.path().to_string())
.map_err(|_| AxError::NotFound)
}

fn handle_relative_path(dir_fd: isize, path: &str) -> AxResult<String> {
let fd_table = FD_TABLE.write();
if dir_fd >= fd_table.count() as isize || dir_fd < 0 {
axlog::warn!("文件描述符索引超出范围");
return Err(AxError::InvalidInput);
}
match super::fs::Directory::from_fd(dir_fd as i32) {
Ok(dir) => {
// 假设目录路径以 '/' 结尾,无需手动添加
Expand Down
Loading