sys: import types from handle or sched, not wasi. drop types:: prefix.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use super::oshandle::RawOsHandle;
|
||||
use crate::handle::HandleRights;
|
||||
use crate::wasi::{types, RightsExt};
|
||||
use crate::handle::{HandleRights, Rights, RightsExt};
|
||||
use std::convert::TryFrom;
|
||||
use std::fs::File;
|
||||
use std::io;
|
||||
@@ -24,16 +23,13 @@ impl TryFrom<File> for OsDir {
|
||||
|
||||
fn get_rights(file: &File) -> io::Result<HandleRights> {
|
||||
use yanix::{fcntl, file::OFlags};
|
||||
let mut rights = HandleRights::new(
|
||||
types::Rights::directory_base(),
|
||||
types::Rights::directory_inheriting(),
|
||||
);
|
||||
let mut rights = HandleRights::new(Rights::directory_base(), Rights::directory_inheriting());
|
||||
let flags = unsafe { fcntl::get_status_flags(file.as_raw_fd())? };
|
||||
let accmode = flags & OFlags::ACCMODE;
|
||||
if accmode == OFlags::RDONLY {
|
||||
rights.base &= !types::Rights::FD_WRITE;
|
||||
rights.base &= !Rights::FD_WRITE;
|
||||
} else if accmode == OFlags::WRONLY {
|
||||
rights.base &= !types::Rights::FD_READ;
|
||||
rights.base &= !Rights::FD_READ;
|
||||
}
|
||||
Ok(rights)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user