Lines Matching refs:SystemError
7 use system_error::SystemError;
489 ) -> Result<usize, SystemError> { in open() argument
492 .map_err(|_| SystemError::EINVAL)?; in open()
494 let open_flags: FileMode = FileMode::from_bits(o_flags).ok_or(SystemError::EINVAL)?; in open()
495 let mode = ModeType::from_bits(mode).ok_or(SystemError::EINVAL)?; in open()
511 ) -> Result<usize, SystemError> { in openat() argument
514 .map_err(|_| SystemError::EINVAL)?; in openat()
516 let open_flags: FileMode = FileMode::from_bits(o_flags).ok_or(SystemError::EINVAL)?; in openat()
517 let mode = ModeType::from_bits(mode).ok_or(SystemError::EINVAL)?; in openat()
526 pub fn close(fd: usize) -> Result<usize, SystemError> { in close() argument
541 pub fn ioctl(fd: usize, cmd: u32, data: usize) -> Result<usize, SystemError> { in ioctl() argument
547 .ok_or(SystemError::EBADF)?; in ioctl()
562 pub fn read(fd: i32, buf: &mut [u8]) -> Result<usize, SystemError> { in read() argument
568 return Err(SystemError::EBADF); in read()
584 pub fn write(fd: i32, buf: &[u8]) -> Result<usize, SystemError> { in write() argument
590 .ok_or(SystemError::EBADF)?; in write()
604 pub fn lseek(fd: i32, offset: i64, seek: u32) -> Result<usize, SystemError> { in lseek() argument
610 _ => Err(SystemError::EINVAL), in lseek()
617 .ok_or(SystemError::EBADF)?; in lseek()
631 pub fn pread(fd: i32, buf: &mut [u8], len: usize, offset: usize) -> Result<usize, SystemError> { in pread() argument
637 return Err(SystemError::EBADF); in pread()
653 pub fn pwrite(fd: i32, buf: &[u8], len: usize, offset: usize) -> Result<usize, SystemError> { in pwrite() argument
659 return Err(SystemError::EBADF); in pwrite()
690 pub fn chdir(path: *const u8) -> Result<usize, SystemError> { in chdir() argument
692 return Err(SystemError::EFAULT); in chdir()
697 .map_err(|_| SystemError::EINVAL)?; in chdir()
730 return Err(SystemError::ENOENT); in chdir()
739 return Err(SystemError::ENOTDIR); in chdir()
750 pub fn getcwd(buf: &mut [u8]) -> Result<VirtAddr, SystemError> { in getcwd() argument
757 return Err(SystemError::ENOMEM); in getcwd()
773 pub fn getdents(fd: i32, buf: &mut [u8]) -> Result<usize, SystemError> { in getdents() argument
775 unsafe { (buf.as_mut_ptr() as *mut Dirent).as_mut() }.ok_or(SystemError::EFAULT)?; in getdents()
778 return Err(SystemError::EBADF); in getdents()
786 .ok_or(SystemError::EBADF)?; in getdents()
801 pub fn mkdir(path: *const u8, mode: usize) -> Result<usize, SystemError> { in mkdir() argument
804 .map_err(|_| SystemError::EINVAL)?; in mkdir()
814 pub fn mkdir_at(dirfd: i32, path: *const u8, mode: usize) -> Result<usize, SystemError> { in mkdir_at() argument
817 .map_err(|_| SystemError::EINVAL)?; in mkdir_at()
839 ) -> Result<usize, SystemError> { in do_linkat() argument
842 return Err(SystemError::EINVAL); in do_linkat()
860 .ok_or(SystemError::EBADF)?; in do_linkat()
864 return Err(SystemError::ENONET); in do_linkat()
873 return Err(SystemError::EPERM); in do_linkat()
886 pub fn link(old: *const u8, new: *const u8) -> Result<usize, SystemError> { in link() argument
887 let get_path = |cstr: *const u8| -> Result<String, SystemError> { in link()
890 .map_err(|_| SystemError::EINVAL)?; in link()
893 return Err(SystemError::ENAMETOOLONG); in link()
896 return Err(SystemError::ENOENT); in link()
917 ) -> Result<usize, SystemError> { in linkat() argument
920 .map_err(|_| SystemError::EINVAL)?; in linkat()
923 .map_err(|_| SystemError::EINVAL)?; in linkat()
925 return Err(SystemError::ENAMETOOLONG); in linkat()
929 return Err(SystemError::ENOENT); in linkat()
931 let flags = AtFlags::from_bits(flags).ok_or(SystemError::EINVAL)?; in linkat()
944 pub fn unlinkat(dirfd: i32, path: *const u8, flags: u32) -> Result<usize, SystemError> { in unlinkat() argument
945 let flags = AtFlags::from_bits(flags as i32).ok_or(SystemError::EINVAL)?; in unlinkat()
949 .map_err(|_| SystemError::EINVAL)?; in unlinkat()
973 pub fn rmdir(path: *const u8) -> Result<usize, SystemError> { in rmdir() argument
976 .map_err(|_| SystemError::EINVAL)?; in rmdir()
980 pub fn unlink(path: *const u8) -> Result<usize, SystemError> { in unlink() argument
983 .map_err(|_| SystemError::EINVAL)?; in unlink()
987 pub fn symlink(oldname: *const u8, newname: *const u8) -> Result<usize, SystemError> { in symlink() argument
995 ) -> Result<usize, SystemError> { in symlinkat() argument
1021 ) -> Result<usize, SystemError> { in do_renameat2() argument
1025 .map_err(|_| SystemError::EINVAL)?; in do_renameat2()
1029 .map_err(|_| SystemError::EINVAL)?; in do_renameat2()
1032 return Err(SystemError::ENAMETOOLONG); in do_renameat2()
1051 pub fn dup(oldfd: i32) -> Result<usize, SystemError> { in dup() argument
1057 .ok_or(SystemError::EBADF)?; in dup()
1059 let new_file = old_file.try_clone().ok_or(SystemError::EBADF)?; in dup()
1080 pub fn dup2(oldfd: i32, newfd: i32) -> Result<usize, SystemError> { in dup2() argument
1086 pub fn dup3(oldfd: i32, newfd: i32, flags: u32) -> Result<usize, SystemError> { in dup3() argument
1089 return Err(SystemError::EINVAL); in dup3()
1093 return Err(SystemError::EINVAL); in dup3()
1105 ) -> Result<usize, SystemError> { in do_dup2() argument
1114 ) -> Result<usize, SystemError> { in do_dup3() argument
1117 return Err(SystemError::EBADF); in do_dup3()
1129 return Err(SystemError::EIO); in do_dup3()
1135 .ok_or(SystemError::EBADF)?; in do_dup3()
1136 let new_file = old_file.try_clone().ok_or(SystemError::EBADF)?; in do_dup3()
1157 pub fn fcntl(fd: i32, cmd: FcntlCommand, arg: i32) -> Result<usize, SystemError> { in fcntl() argument
1162 return Err(SystemError::EBADF); in fcntl()
1181 return Err(SystemError::EMFILE); in fcntl()
1198 return Err(SystemError::EBADF); in fcntl()
1216 return Err(SystemError::EBADF); in fcntl()
1230 return Err(SystemError::EBADF); in fcntl()
1239 let mode = FileMode::from_bits(arg).ok_or(SystemError::EINVAL)?; in fcntl()
1246 return Err(SystemError::EBADF); in fcntl()
1253 return Err(SystemError::ENOSYS); in fcntl()
1274 pub fn ftruncate(fd: i32, len: usize) -> Result<usize, SystemError> { in ftruncate() argument
1285 return Err(SystemError::EBADF); in ftruncate()
1288 fn do_fstat(fd: i32) -> Result<PosixKstat, SystemError> { in do_fstat() argument
1293 .ok_or(SystemError::EBADF)?; in do_fstat()
1333 pub fn fstat(fd: i32, usr_kstat: *mut PosixKstat) -> Result<usize, SystemError> { in fstat() argument
1341 pub fn stat(path: *const u8, user_kstat: *mut PosixKstat) -> Result<usize, SystemError> { in stat() argument
1353 pub fn lstat(path: *const u8, user_kstat: *mut PosixKstat) -> Result<usize, SystemError> { in lstat() argument
1365 pub fn statfs(path: *const u8, user_statfs: *mut PosixStatfs) -> Result<usize, SystemError> { in statfs() argument
1376 .map_err(|_| SystemError::EINVAL)?; in statfs()
1385 pub fn fstatfs(fd: i32, user_statfs: *mut PosixStatfs) -> Result<usize, SystemError> { in fstatfs() argument
1391 .ok_or(SystemError::EBADF)?; in fstatfs()
1404 ) -> Result<usize, SystemError> { in do_statx() argument
1406 return Err(SystemError::EFAULT); in do_statx()
1412 return Err(SystemError::ENAVAIL); in do_statx()
1422 .ok_or(SystemError::EBADF)?; in do_statx()
1510 ) -> Result<usize, SystemError> { in mknod() argument
1513 .map_err(|_| SystemError::EINVAL)?; in mknod()
1516 let inode: Result<Arc<dyn IndexNode>, SystemError> = in mknod()
1520 return Err(SystemError::EEXIST); in mknod()
1534 pub fn writev(fd: i32, iov: usize, count: usize) -> Result<usize, SystemError> { in writev() argument
1543 pub fn readv(fd: i32, iov: usize, count: usize) -> Result<usize, SystemError> { in readv() argument
1561 ) -> Result<usize, SystemError> { in readlink_at() argument
1564 .map_err(|_| SystemError::EINVAL)?; in readlink_at()
1572 return Err(SystemError::EINVAL); in readlink_at()
1588 ) -> Result<usize, SystemError> { in readlink() argument
1592 pub fn access(pathname: *const u8, mode: u32) -> Result<usize, SystemError> { in access() argument
1596 ModeType::from_bits(mode).ok_or(SystemError::EINVAL)?, in access()
1606 ) -> Result<usize, SystemError> { in faccessat2() argument
1610 ModeType::from_bits(mode).ok_or(SystemError::EINVAL)?, in faccessat2()
1615 pub fn chmod(pathname: *const u8, mode: u32) -> Result<usize, SystemError> { in chmod() argument
1619 ModeType::from_bits(mode).ok_or(SystemError::EINVAL)?, in chmod()
1623 pub fn fchmodat(dirfd: i32, pathname: *const u8, mode: u32) -> Result<usize, SystemError> { in fchmodat() argument
1627 ModeType::from_bits(mode).ok_or(SystemError::EINVAL)?, in fchmodat()
1631 pub fn fchmod(fd: i32, mode: u32) -> Result<usize, SystemError> { in fchmod() argument
1632 let _mode = ModeType::from_bits(mode).ok_or(SystemError::EINVAL)?; in fchmod()
1637 .ok_or(SystemError::EBADF)?; in fchmod()
1645 pub fn chown(pathname: *const u8, uid: usize, gid: usize) -> Result<usize, SystemError> { in chown() argument
1648 .map_err(|_| SystemError::EINVAL)?; in chown()
1658 pub fn lchown(pathname: *const u8, uid: usize, gid: usize) -> Result<usize, SystemError> { in lchown() argument
1661 .map_err(|_| SystemError::EINVAL)?; in lchown()
1677 ) -> Result<usize, SystemError> { in fchownat() argument
1680 .map_err(|_| SystemError::EINVAL)?; in fchownat()
1686 pub fn fchown(fd: i32, uid: usize, gid: usize) -> Result<usize, SystemError> { in fchown() argument
1711 ) -> Result<usize, SystemError> { in mount() argument
1714 .map_err(|_| SystemError::EINVAL)?; in mount()
1717 let fstype_str = fstype_str.to_str().map_err(|_| SystemError::EINVAL)?; in mount()
1734 pub fn umount2(target: *const u8, flags: i32) -> Result<(), SystemError> { in umount2() argument
1737 .map_err(|_| SystemError::EINVAL)?; in umount2()
1741 UmountFlag::from_bits(flags).ok_or(SystemError::EINVAL)?, in umount2()
1751 ) -> Result<usize, SystemError> { in sys_utimensat() argument
1757 .map_err(|_| SystemError::EINVAL)?; in sys_utimensat()
1760 let flags = UtimensFlags::from_bits(flags).ok_or(SystemError::EINVAL)?; in sys_utimensat()
1774 ) -> Result<usize, SystemError> { in sys_utimes() argument
1777 .map_err(|_| SystemError::EINVAL)?; in sys_utimes()
1817 ) -> Result<Self, SystemError> { in from_user() argument
1823 .map_err(|_| SystemError::EFAULT)?; in from_user()
1839 .map_err(|_| SystemError::EFAULT)?; in from_user()