Lines Matching full:libc
42 // Mapping from 9P flags to libc flags.
44 (P9_WRONLY, libc::O_WRONLY),
45 (P9_RDWR, libc::O_RDWR),
46 (P9_CREATE, libc::O_CREAT),
47 (P9_EXCL, libc::O_EXCL),
48 (P9_NOCTTY, libc::O_NOCTTY),
49 (P9_TRUNC, libc::O_TRUNC),
50 (P9_APPEND, libc::O_APPEND),
51 (P9_NONBLOCK, libc::O_NONBLOCK),
52 (P9_DSYNC, libc::O_DSYNC),
54 (P9_DIRECT, libc::O_DIRECT),
55 (P9_LARGEFILE, libc::O_LARGEFILE),
56 (P9_DIRECTORY, libc::O_DIRECTORY),
57 (P9_NOFOLLOW, libc::O_NOFOLLOW),
58 (P9_NOATIME, libc::O_NOATIME),
59 (P9_SYNC, libc::O_SYNC),
115 impl From<libc::mode_t> for FileType {
116 fn from(mode: libc::mode_t) -> Self { in from()
117 match mode & libc::S_IFMT { in from()
118 libc::S_IFREG => FileType::Regular, in from()
119 libc::S_IFDIR => FileType::Directory, in from()
136 impl From<libc::stat64> for Qid {
137 fn from(st: libc::stat64) -> Qid { in from()
138 let ty = match st.st_mode & libc::S_IFMT { in from()
139 libc::S_IFDIR => P9_QTDIR, in from()
140 libc::S_IFREG => P9_QTFILE, in from()
141 libc::S_IFLNK => P9_QTSYMLINK, in from()
154 fn statat(d: &File, name: &CStr, flags: libc::c_int) -> io::Result<libc::stat64> { in statat()
155 let mut st = MaybeUninit::<libc::stat64>::zeroed(); in statat()
160 libc::fstatat64( in statat()
164 flags | libc::AT_SYMLINK_NOFOLLOW, in statat()
175 fn stat(f: &File) -> io::Result<libc::stat64> { in stat()
179 statat(f, pathname, libc::AT_EMPTY_PATH) in stat()
183 CString::new(s).map_err(|_| io::Error::from_raw_os_error(libc::EINVAL)) in string_to_cstring()
192 io::ErrorKind::NotFound => libc::ENOENT, in error_to_rmessage()
193 io::ErrorKind::PermissionDenied => libc::EPERM, in error_to_rmessage()
194 io::ErrorKind::ConnectionRefused => libc::ECONNREFUSED, in error_to_rmessage()
195 io::ErrorKind::ConnectionReset => libc::ECONNRESET, in error_to_rmessage()
196 io::ErrorKind::ConnectionAborted => libc::ECONNABORTED, in error_to_rmessage()
197 io::ErrorKind::NotConnected => libc::ENOTCONN, in error_to_rmessage()
198 io::ErrorKind::AddrInUse => libc::EADDRINUSE, in error_to_rmessage()
199 io::ErrorKind::AddrNotAvailable => libc::EADDRNOTAVAIL, in error_to_rmessage()
200 io::ErrorKind::BrokenPipe => libc::EPIPE, in error_to_rmessage()
201 io::ErrorKind::AlreadyExists => libc::EEXIST, in error_to_rmessage()
202 io::ErrorKind::WouldBlock => libc::EWOULDBLOCK, in error_to_rmessage()
203 io::ErrorKind::InvalidInput => libc::EINVAL, in error_to_rmessage()
204 io::ErrorKind::InvalidData => libc::EINVAL, in error_to_rmessage()
205 io::ErrorKind::TimedOut => libc::ETIMEDOUT, in error_to_rmessage()
206 io::ErrorKind::WriteZero => libc::EIO, in error_to_rmessage()
207 io::ErrorKind::Interrupted => libc::EINTR, in error_to_rmessage()
208 io::ErrorKind::Other => libc::EIO, in error_to_rmessage()
209 io::ErrorKind::UnexpectedEof => libc::EIO, in error_to_rmessage()
210 _ => libc::EIO, in error_to_rmessage()
237 io::Error::from_raw_os_error(libc::EBADF) in ebadf()
241 pub type ServerUidMap = ServerIdMap<libc::uid_t>;
242 pub type ServerGidMap = ServerIdMap<libc::gid_t>;
259 Err(io::Error::from_raw_os_error(libc::ENOENT)) in ascii_casefold_lookup()
265 libc::openat( in lookup()
268 libc::O_PATH | libc::O_NOFOLLOW | libc::O_CLOEXEC, in lookup()
281 mds: &mut Vec<libc::stat64>, in do_walk()
289 if let Some(libc::ENOENT) = e.raw_os_error() { in do_walk()
306 let mut flags: i32 = libc::O_CLOEXEC; in open_fid()
314 flags |= libc::O_RDONLY; in open_fid()
320 libc::openat( in open_fid()
323 flags & !libc::O_NOFOLLOW, in open_fid()
380 libc::openat( in with_config()
381 libc::AT_FDCWD, in with_config()
383 libc::O_PATH | libc::O_NOFOLLOW | libc::O_CLOEXEC, in with_config()
455 Err(io::Error::from_raw_os_error(libc::EOPNOTSUPP)) in auth()
467 libc::openat( in attach()
468 libc::AT_FDCWD, in attach()
470 libc::O_PATH | libc::O_NOFOLLOW | libc::O_CLOEXEC, in attach()
487 btree_map::Entry::Occupied(_) => Err(io::Error::from_raw_os_error(libc::EBADF)), in attach()
493 return Err(io::Error::from_raw_os_error(libc::EINVAL)); in version()
518 return Err(io::Error::from_raw_os_error(libc::EBADF)); in walk()
606 btree_map::Entry::Vacant(_) => Err(io::Error::from_raw_os_error(libc::EBADF)), in clunk()
618 Err(io::Error::from_raw_os_error(libc::EOPNOTSUPP)) in remove()
626 syscall!(unsafe { libc::fstatfs64(fid.path.as_raw_fd(), buf.as_mut_ptr()) })?; in statfs()
663 return Err(io::Error::from_raw_os_error(libc::ENOTDIR)); in lcreate()
666 let mut flags: i32 = libc::O_CLOEXEC | libc::O_CREAT | libc::O_EXCL; in lcreate()
673 flags |= libc::O_RDONLY; in lcreate()
680 libc::openat(fid.path.as_raw_fd(), name.as_ptr(), flags, lcreate.mode) in lcreate()
702 Err(io::Error::from_raw_os_error(libc::EACCES)) in symlink()
707 Err(io::Error::from_raw_os_error(libc::EACCES)) in mknod()
714 Err(io::Error::from_raw_os_error(libc::EOPNOTSUPP)) in rename()
719 Err(io::Error::from_raw_os_error(libc::EACCES)) in readlink()
754 return Err(io::Error::from_raw_os_error(libc::EPERM)); in set_attr()
776 libc::timespec { in set_attr()
779 libc::UTIME_OMIT in set_attr()
781 libc::UTIME_NOW in set_attr()
786 libc::timespec { in set_attr()
789 libc::UTIME_OMIT in set_attr()
791 libc::UTIME_NOW in set_attr()
799 let ret = unsafe { libc::futimens(file.as_raw_fd(), × as *const libc::timespec) }; in set_attr() constant
811 libc::fchown( in set_attr()
813 libc::uid_t::max_value(), in set_attr()
814 libc::gid_t::max_value(), in set_attr()
826 Err(io::Error::from_raw_os_error(libc::EOPNOTSUPP)) in xattr_walk()
830 Err(io::Error::from_raw_os_error(libc::EOPNOTSUPP)) in xattr_create()
837 return Err(io::Error::from_raw_os_error(libc::ENOTDIR)); in readdir()
853 let mut dirents = read_dir(dir, readdir.offset as libc::off64_t)?; in readdir()
902 Err(io::Error::from_raw_os_error(libc::EOPNOTSUPP)) in lock()
906 Err(io::Error::from_raw_os_error(libc::EOPNOTSUPP)) in get_lock()
918 libc::linkat( in link()
923 libc::AT_SYMLINK_FOLLOW, in link()
934 syscall!(unsafe { libc::mkdirat(fid.path.as_raw_fd(), name.as_ptr(), mkdir.mode) })?; in mkdir()
949 libc::renameat( in rename_at()
965 libc::unlinkat( in unlink_at()
968 unlink_at.flags as libc::c_int, in unlink_at()