|
|
@ -388,7 +388,7 @@ impl Syscall<'_> {
|
|
|
|
flags: usize,
|
|
|
|
flags: usize,
|
|
|
|
) -> SysResult {
|
|
|
|
) -> SysResult {
|
|
|
|
let proc = self.process();
|
|
|
|
let proc = self.process();
|
|
|
|
let path = unsafe { check_and_clone_cstr(path)? };
|
|
|
|
let path = check_and_clone_cstr(path)?;
|
|
|
|
let stat_ref = unsafe { self.vm().check_write_ptr(stat_ptr)? };
|
|
|
|
let stat_ref = unsafe { self.vm().check_write_ptr(stat_ptr)? };
|
|
|
|
let flags = AtFlags::from_bits_truncate(flags);
|
|
|
|
let flags = AtFlags::from_bits_truncate(flags);
|
|
|
|
info!(
|
|
|
|
info!(
|
|
|
@ -539,7 +539,7 @@ impl Syscall<'_> {
|
|
|
|
|
|
|
|
|
|
|
|
pub fn sys_chdir(&mut self, path: *const u8) -> SysResult {
|
|
|
|
pub fn sys_chdir(&mut self, path: *const u8) -> SysResult {
|
|
|
|
let mut proc = self.process();
|
|
|
|
let mut proc = self.process();
|
|
|
|
let path = unsafe { check_and_clone_cstr(path)? };
|
|
|
|
let path = check_and_clone_cstr(path)?;
|
|
|
|
if !proc.pid.is_init() {
|
|
|
|
if !proc.pid.is_init() {
|
|
|
|
// we trust pid 0 process
|
|
|
|
// we trust pid 0 process
|
|
|
|
info!("chdir: path: {:?}", path);
|
|
|
|
info!("chdir: path: {:?}", path);
|
|
|
@ -592,8 +592,8 @@ impl Syscall<'_> {
|
|
|
|
newpath: *const u8,
|
|
|
|
newpath: *const u8,
|
|
|
|
) -> SysResult {
|
|
|
|
) -> SysResult {
|
|
|
|
let proc = self.process();
|
|
|
|
let proc = self.process();
|
|
|
|
let oldpath = unsafe { check_and_clone_cstr(oldpath)? };
|
|
|
|
let oldpath = check_and_clone_cstr(oldpath)?;
|
|
|
|
let newpath = unsafe { check_and_clone_cstr(newpath)? };
|
|
|
|
let newpath = check_and_clone_cstr(newpath)?;
|
|
|
|
info!(
|
|
|
|
info!(
|
|
|
|
"renameat: olddirfd: {}, oldpath: {:?}, newdirfd: {}, newpath: {:?}",
|
|
|
|
"renameat: olddirfd: {}, oldpath: {:?}, newdirfd: {}, newpath: {:?}",
|
|
|
|
olddirfd as isize, oldpath, newdirfd as isize, newpath
|
|
|
|
olddirfd as isize, oldpath, newdirfd as isize, newpath
|
|
|
@ -613,7 +613,7 @@ impl Syscall<'_> {
|
|
|
|
|
|
|
|
|
|
|
|
pub fn sys_mkdirat(&mut self, dirfd: usize, path: *const u8, mode: usize) -> SysResult {
|
|
|
|
pub fn sys_mkdirat(&mut self, dirfd: usize, path: *const u8, mode: usize) -> SysResult {
|
|
|
|
let proc = self.process();
|
|
|
|
let proc = self.process();
|
|
|
|
let path = unsafe { check_and_clone_cstr(path)? };
|
|
|
|
let path = check_and_clone_cstr(path)?;
|
|
|
|
// TODO: check pathname
|
|
|
|
// TODO: check pathname
|
|
|
|
info!(
|
|
|
|
info!(
|
|
|
|
"mkdirat: dirfd: {}, path: {:?}, mode: {:#o}",
|
|
|
|
"mkdirat: dirfd: {}, path: {:?}, mode: {:#o}",
|
|
|
@ -631,7 +631,7 @@ impl Syscall<'_> {
|
|
|
|
|
|
|
|
|
|
|
|
pub fn sys_rmdir(&mut self, path: *const u8) -> SysResult {
|
|
|
|
pub fn sys_rmdir(&mut self, path: *const u8) -> SysResult {
|
|
|
|
let proc = self.process();
|
|
|
|
let proc = self.process();
|
|
|
|
let path = unsafe { check_and_clone_cstr(path)? };
|
|
|
|
let path = check_and_clone_cstr(path)?;
|
|
|
|
info!("rmdir: path: {:?}", path);
|
|
|
|
info!("rmdir: path: {:?}", path);
|
|
|
|
|
|
|
|
|
|
|
|
let (dir_path, file_name) = split_path(&path);
|
|
|
|
let (dir_path, file_name) = split_path(&path);
|
|
|
@ -657,8 +657,8 @@ impl Syscall<'_> {
|
|
|
|
flags: usize,
|
|
|
|
flags: usize,
|
|
|
|
) -> SysResult {
|
|
|
|
) -> SysResult {
|
|
|
|
let proc = self.process();
|
|
|
|
let proc = self.process();
|
|
|
|
let oldpath = unsafe { check_and_clone_cstr(oldpath)? };
|
|
|
|
let oldpath = check_and_clone_cstr(oldpath)?;
|
|
|
|
let newpath = unsafe { check_and_clone_cstr(newpath)? };
|
|
|
|
let newpath = check_and_clone_cstr(newpath)?;
|
|
|
|
let flags = AtFlags::from_bits_truncate(flags);
|
|
|
|
let flags = AtFlags::from_bits_truncate(flags);
|
|
|
|
info!(
|
|
|
|
info!(
|
|
|
|
"linkat: olddirfd: {}, oldpath: {:?}, newdirfd: {}, newpath: {:?}, flags: {:?}",
|
|
|
|
"linkat: olddirfd: {}, oldpath: {:?}, newdirfd: {}, newpath: {:?}, flags: {:?}",
|
|
|
|