Panic upon use of unsupported flags

This commit is contained in:
Jeremy Soller 2016-09-16 13:45:00 -06:00
parent 6ad843184d
commit 0b2fd79816
2 changed files with 58 additions and 46 deletions

View file

@ -46,6 +46,10 @@ pub fn brk(address: usize) -> Result<usize> {
}
}
pub const CLONE_VM: usize = 0x100;
pub const CLONE_FS: usize = 0x200;
pub const CLONE_FILES: usize = 0x400;
pub const CLONE_VFORK: usize = 0x4000;
pub fn clone(flags: usize, stack_base: usize) -> Result<usize> {
//TODO: Implement flags
//TODO: Copy on write?
@ -78,6 +82,9 @@ pub fn clone(flags: usize, stack_base: usize) -> Result<usize> {
kstack_option = Some(new_stack);
}
if flags & CLONE_VM == CLONE_VM {
panic!("unimplemented: CLONE_VM");
} else {
for memory in context.image.iter() {
let mut new_memory = context::memory::Memory::new(
VirtualAddress::new(memory.start_address().get() + arch::USER_TMP_OFFSET),
@ -111,6 +118,7 @@ pub fn clone(flags: usize, stack_base: usize) -> Result<usize> {
new_heap.remap(heap.flags(), true);
heap_option = Some(new_heap);
}
}
if let Some(ref stack) = context.stack {
let mut new_stack = context::memory::Memory::new(
@ -129,6 +137,9 @@ pub fn clone(flags: usize, stack_base: usize) -> Result<usize> {
stack_option = Some(new_stack);
}
if flags & CLONE_FILES == CLONE_FILES {
panic!("unimplemented: CLONE_FILES");
} else {
for (fd, file_option) in context.files.iter().enumerate() {
if let Some(file) = *file_option {
let result = {
@ -150,6 +161,7 @@ pub fn clone(flags: usize, stack_base: usize) -> Result<usize> {
}
}
}
}
// Set up new process
{

2
libstd

@ -1 +1 @@
Subproject commit eaad8f520ce853c15c2071eff08ed813e87118fa
Subproject commit 00920975234a9bc774ad6e33efd57a56a40c0ee8