Lines Matching refs:SystemError
9 syscall::{Syscall, SystemError},
129 pub fn open(path: &str, mode: FileMode) -> Result<usize, SystemError> { in open() argument
133 return Err(SystemError::ENAMETOOLONG); in open()
136 let inode: Result<Arc<dyn IndexNode>, SystemError> = ROOT_INODE().lookup(path); in open()
143 && errno == SystemError::ENOENT in open()
164 return Err(SystemError::ENOTDIR); in open()
194 pub fn close(fd: usize) -> Result<usize, SystemError> { in close() argument
206 pub fn read(fd: i32, buf: &mut [u8]) -> Result<usize, SystemError> { in read() argument
210 return Err(SystemError::EBADF); in read()
224 pub fn write(fd: i32, buf: &[u8]) -> Result<usize, SystemError> { in write() argument
228 return Err(SystemError::EBADF); in write()
242 pub fn lseek(fd: i32, seek: SeekFrom) -> Result<usize, SystemError> { in lseek() argument
246 return Err(SystemError::EBADF); in lseek()
274 pub fn chdir(dest_path: &str) -> Result<usize, SystemError> { in chdir() argument
280 return Err(SystemError::ENOENT); in chdir()
288 return Err(SystemError::ENOENT); in chdir()
294 return Err(SystemError::ENOTDIR); in chdir()
308 pub fn getdents(fd: i32, buf: &mut [u8]) -> Result<usize, SystemError> { in getdents() argument
310 unsafe { (buf.as_mut_ptr() as *mut Dirent).as_mut() }.ok_or(SystemError::EFAULT)?; in getdents()
313 return Err(SystemError::EBADF); in getdents()
319 return Err(SystemError::EBADF); in getdents()
333 pub fn mkdir(path: &str, mode: usize) -> Result<usize, SystemError> { in mkdir() argument
346 pub fn unlinkat(_dirfd: i32, pathname: &str, flags: u32) -> Result<usize, SystemError> { in unlinkat() argument
349 return Err(SystemError::EINVAL); in unlinkat()
377 pub fn dup(oldfd: i32) -> Result<usize, SystemError> { in dup() argument
384 let file_cp: Box<File> = file.try_clone().ok_or(SystemError::EBADF)?; in dup()
391 return Err(SystemError::EBADF); in dup()
393 return Err(SystemError::EBADF); in dup()
395 return Err(SystemError::EMFILE); in dup()
412 pub fn dup2(oldfd: i32, newfd: i32) -> Result<usize, SystemError> { in dup2() argument
427 return Err(SystemError::EIO); in dup2()
434 return Err(SystemError::EBADF); in dup2()
443 return Err(SystemError::EBADF); in dup2()
445 return Err(SystemError::EBADF); in dup2()
449 return Err(SystemError::EMFILE); in dup2()
459 pub fn fcntl(fd: i32, cmd: FcntlCommand, arg: i32) -> Result<usize, SystemError> { in fcntl() argument
463 return Err(SystemError::EBADF); in fcntl()
473 return Err(SystemError::EMFILE); in fcntl()
485 return Err(SystemError::EBADF); in fcntl()
488 return Err(SystemError::EBADF); in fcntl()
503 return Err(SystemError::EBADF); in fcntl()
506 return Err(SystemError::EBADF); in fcntl()
516 return Err(SystemError::EBADF); in fcntl()
519 return Err(SystemError::EBADF); in fcntl()
527 let mode = FileMode::from_bits(arg).ok_or(SystemError::EINVAL)?; in fcntl()
531 return Err(SystemError::EBADF); in fcntl()
534 return Err(SystemError::EBADF); in fcntl()
562 pub fn ftruncate(fd: i32, len: usize) -> Result<usize, SystemError> { in ftruncate() argument
569 return Err(SystemError::EBADF); in ftruncate()
572 return Err(SystemError::EBADF); in ftruncate()
574 fn do_fstat(fd: i32) -> Result<PosixKstat, SystemError> { in do_fstat() argument
616 return Err(SystemError::EINVAL); in do_fstat()
620 pub fn fstat(fd: i32, usr_kstat: *mut PosixKstat) -> Result<usize, SystemError> { in fstat() argument
624 return Err(SystemError::EFAULT); in fstat()
664 ) -> Result<Self, SystemError> { in from_user() argument
670 return Err(SystemError::EFAULT); in from_user()
685 return Err(SystemError::EFAULT); in from_user()