1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-21 15:46:17 +04:00

Fix /proc/self/fd not found panic

This commit is contained in:
Jiajie Chen 2019-05-03 15:00:45 +08:00
parent 6d14fbf3db
commit 7331404fc7
7 changed files with 19 additions and 15 deletions

View File

@ -1,11 +1,11 @@
use core::fmt;
use super::ioctl::*;
use super::FileHandle;
use crate::net::Socket;
use crate::syscall::{SysError, SysResult};
use alloc::boxed::Box;
use rcore_fs::vfs::PollStatus;
use super::ioctl::*;
// TODO: merge FileLike to FileHandle ?
// TODO: fix dup and remove Clone

View File

@ -33,4 +33,4 @@ pub const FIONCLEX: usize = 0x6602;
#[cfg(not(target_arch = "mips"))]
pub const FIOCLEX: usize = 0x5451;
#[cfg(target_arch = "mips")]
pub const FIOCLEX: usize = 0x6601;
pub const FIOCLEX: usize = 0x6601;

View File

@ -1,7 +1,7 @@
use alloc::{sync::Arc, vec::Vec};
use rcore_fs::vfs::*;
use rcore_fs::dev::block_cache::BlockCache;
use rcore_fs::vfs::*;
use rcore_fs_sfs::SimpleFileSystem;
use crate::drivers::BlockDriver;
@ -15,10 +15,10 @@ pub use self::stdio::{STDIN, STDOUT};
mod device;
mod file;
mod file_like;
mod ioctl;
mod pipe;
mod pseudo;
mod stdio;
mod ioctl;
/// Hard link user programs
#[cfg(feature = "link_user")]

View File

@ -5,9 +5,9 @@ use core::any::Any;
use rcore_fs::vfs::*;
use super::ioctl::*;
use crate::sync::Condvar;
use crate::sync::SpinNoIrqLock as Mutex;
use super::ioctl::*;
#[derive(Default)]
pub struct Stdin {

View File

@ -1,10 +1,10 @@
//! Kernel shell
use crate::arch::io;
use crate::fs::ROOT_INODE;
use crate::process::*;
use alloc::string::String;
use alloc::vec::Vec;
use crate::arch::io;
#[cfg(not(feature = "run_cmdline"))]
pub fn add_user_shell() {
@ -47,7 +47,7 @@ pub fn add_user_shell() {
&inode,
cmdline.split(' ').map(|s| s.into()).collect(),
Vec::new(),
Vec::new()
Vec::new(),
));
}

View File

@ -784,14 +784,18 @@ impl Process {
_ => {}
}
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,
"/proc/self/fd" => {
let fd: u32 = fd_name.parse::<u32>().unwrap();
let fd_path = match self.files.get(&(fd as usize)) {
Some(FileLike::File(file)) => Some(&file.path),
_ => return Err(SysError::ENOENT),
};
info!("lookup_inode_at:BEG /proc/sefl/fd {}, path {}", fd, fd_path.unwrap());
if(fd_path.is_some()) {
info!(
"lookup_inode_at:BEG /proc/self/fd {}, path {}",
fd,
fd_path.unwrap()
);
if (fd_path.is_some()) {
return Ok(Arc::new(Pseudo::new(fd_path.unwrap(), FileType::SymLink)));
} else {
{}

2
user

@ -1 +1 @@
Subproject commit b6a347750531be125583107b6d0fc307366fdcc9
Subproject commit bb73d6ecce1ab0e6fae692c51e4335772b0335d4