|
|
@ -776,12 +776,29 @@ impl Process {
|
|
|
|
dirfd as isize, self.cwd, path, follow
|
|
|
|
dirfd as isize, self.cwd, path, follow
|
|
|
|
);
|
|
|
|
);
|
|
|
|
// hard code special path
|
|
|
|
// hard code special path
|
|
|
|
|
|
|
|
let (fd_dir_path, fd_name) = split_path(&path);
|
|
|
|
match path {
|
|
|
|
match path {
|
|
|
|
"/proc/self/exe" => {
|
|
|
|
"/proc/self/exe" => {
|
|
|
|
return Ok(Arc::new(Pseudo::new(&self.exec_path, FileType::SymLink)));
|
|
|
|
return Ok(Arc::new(Pseudo::new(&self.exec_path, FileType::SymLink)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => {}
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
match fd_dir_path {
|
|
|
|
|
|
|
|
"/proc/self/fd" =>{
|
|
|
|
|
|
|
|
let fd:u32= fd_name.parse::<u32>().unwrap();
|
|
|
|
|
|
|
|
let fd_path= match self.files.get(&(fd as usize)).unwrap() {
|
|
|
|
|
|
|
|
FileLike::File(file) => Some(&file.path),
|
|
|
|
|
|
|
|
_ => None,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
info!("lookup_inode_at:BEG /proc/sefl/fd {}, path {}", fd, fd_path.unwrap());
|
|
|
|
|
|
|
|
if(fd_path.is_some()) {
|
|
|
|
|
|
|
|
return Ok(Arc::new(Pseudo::new(fd_path.unwrap(), FileType::SymLink)));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_ => {}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let follow_max_depth = if follow { FOLLOW_MAX_DEPTH } else { 0 };
|
|
|
|
let follow_max_depth = if follow { FOLLOW_MAX_DEPTH } else { 0 };
|
|
|
|
if dirfd == AT_FDCWD {
|
|
|
|
if dirfd == AT_FDCWD {
|
|
|
@ -1392,5 +1409,5 @@ impl FdSet {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//pathname is interpreted relative to the current working directory(CWD)
|
|
|
|
const AT_FDCWD: usize = -100isize as usize;
|
|
|
|
const AT_FDCWD: usize = -100isize as usize;
|
|
|
|