使用DragonReach启动shell,修改getdents (#391)

* 使用DragonReach启动shell,修改getdents

* 更改关闭pipe时断言报错问题,以及DragonReach启动shell阶段版本

* 修改目录结构

* update

* 解决小问题

* 调整dragon reach版本号

* 设置make clean的时候不清空应用程序的缓存。
指定relibc版本号

---------

Co-authored-by: longjin <longjin@RinGoTek.cn>
This commit is contained in:
GnoCiYeH
2023-09-30 16:36:06 +08:00
committed by GitHub
parent 0dd8ff4332
commit bb0e4d4131
8 changed files with 85 additions and 18 deletions

View File

@ -7,7 +7,7 @@ use crate::driver::pci::pci::{
use crate::driver::pci::pci_irq::{IrqCommonMsg, IrqMsg, IrqSpecificMsg, PciInterrupt, IRQ};
use crate::include::bindings::bindings::pt_regs;
use crate::kdebug;
use crate::libs::volatile::{
volread, volwrite, ReadOnly, Volatile, VolatileReadable, VolatileWritable, WriteOnly,
};

View File

@ -277,8 +277,6 @@ impl File {
self.offset += 1;
dirent.d_ino = sub_inode.metadata().unwrap().inode_id.into() as u64;
dirent.d_off = 0;
dirent.d_reclen = 0;
dirent.d_type = sub_inode.metadata().unwrap().file_type.get_file_type_num() as u8;
// 根据posix的规定dirent中的d_name是一个不定长的数组因此需要unsafe来拷贝数据
unsafe {
@ -289,8 +287,13 @@ impl File {
}
// 计算dirent结构体的大小
return Ok((name_bytes.len() + ::core::mem::size_of::<Dirent>()
- ::core::mem::size_of_val(&dirent.d_name)) as u64);
let size = (name_bytes.len() + ::core::mem::size_of::<Dirent>()
- ::core::mem::size_of_val(&dirent.d_name)) as u64;
dirent.d_reclen = size as u16;
dirent.d_off += dirent.d_reclen as i64;
return Ok(size);
}
pub fn inode(&self) -> Arc<dyn IndexNode> {

View File

@ -182,13 +182,13 @@ impl ProcessManager {
let new_fd_table = current_pcb.basic().fd_table().unwrap().read().clone();
let new_fd_table = Arc::new(RwLock::new(new_fd_table));
new_pcb.basic_mut().set_fd_table(Some(new_fd_table));
} else {
// 如果共享文件描述符表,则直接拷贝指针
new_pcb
.basic_mut()
.set_fd_table(current_pcb.basic().fd_table().clone());
}
// 如果共享文件描述符表,则直接拷贝指针
new_pcb
.basic_mut()
.set_fd_table(current_pcb.basic().fd_table().clone());
return Ok(());
}

View File

@ -36,9 +36,9 @@ pub fn initial_kernel_thread() -> i32 {
/// 切换到用户态
fn switch_to_user() {
let path = String::from("/bin/shell.elf");
let argv = vec![String::from("/bin/shell.elf")];
let envp = vec![String::from("PATH=/bin")];
let path = String::from("/bin/DragonReach");
let argv = vec![String::from("/bin/DragonReach")];
let envp = vec![String::from("PATH=/")];
unsafe { arch_switch_to_user(path, argv, envp) };
}