1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-22 08:06:17 +04:00

auto open stdin/out/err for new proc. pass biscuit hello,cat,echo ...

This commit is contained in:
WangRunji 2019-02-21 19:17:36 +08:00
parent c69386fbc2
commit e1dacb28ef
3 changed files with 10 additions and 5 deletions

View File

@ -63,5 +63,5 @@ before_script:
fi
script:
- cd user && make sfsimg arch=$ARCH && cd ..
- cd kernel && make build arch=$ARCH $OPTS && cd ..
- cd user && make arch=$ARCH

View File

@ -1,7 +1,7 @@
use alloc::{boxed::Box, collections::BTreeMap, string::String, sync::Arc, vec::Vec};
use log::*;
use simple_filesystem::file::File;
use simple_filesystem::{file::File, INode};
use spin::Mutex;
use rcore_process::Context;
use xmas_elf::{ElfFile, header, program::{Flags, Type}};
@ -16,7 +16,7 @@ pub struct Process {
pub arch: ArchContext,
pub memory_set: MemorySet,
pub kstack: KernelStack,
pub files: BTreeMap<usize, Arc<Mutex<File>>>,
pub files: BTreeMap<usize, Arc<Mutex<File>>>, // FIXME: => Box<File>
pub cwd: String,
}
@ -100,6 +100,11 @@ impl Process {
let kstack = KernelStack::new();
let mut files = BTreeMap::new();
files.insert(0, Arc::new(Mutex::new(File::new(crate::fs::STDIN.clone(), true, false))));
files.insert(1, Arc::new(Mutex::new(File::new(crate::fs::STDOUT.clone(), false, true))));
files.insert(2, Arc::new(Mutex::new(File::new(crate::fs::STDOUT.clone(), false, true))));
Box::new(Process {
arch: unsafe {
ArchContext::new_user_thread(
@ -107,7 +112,7 @@ impl Process {
},
memory_set,
kstack,
files: BTreeMap::default(),
files,
cwd: String::new(),
})
}

2
user

@ -1 +1 @@
Subproject commit 86bb44b00d6af6f8fc63bc6179bc0b6cb5d3373b
Subproject commit d84f21465c97dbcdbc998be72f3431de3b077fb0