Mount chan and shm O_NONBLOCK
This commit is contained in:
+9
-3
@@ -2,8 +2,9 @@ use crate::post_fevent;
|
||||
use std::{
|
||||
cmp,
|
||||
collections::{HashMap, VecDeque},
|
||||
fs::File,
|
||||
io
|
||||
fs::{File, OpenOptions},
|
||||
io,
|
||||
os::unix::fs::OpenOptionsExt,
|
||||
};
|
||||
use syscall::{flag::*, error::*, Error, SchemeBlockMut, Result};
|
||||
|
||||
@@ -102,7 +103,12 @@ impl ChanScheme {
|
||||
handles: HashMap::new(),
|
||||
listeners: HashMap::new(),
|
||||
next_id: 0,
|
||||
socket: File::create(":chan")?
|
||||
socket: OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(true)
|
||||
.custom_flags(O_NONBLOCK as i32)
|
||||
.open(":chan")?
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+10
-4
@@ -1,11 +1,12 @@
|
||||
use std::{
|
||||
cmp,
|
||||
collections::{HashMap, hash_map::Entry},
|
||||
fs::File,
|
||||
fs::{File, OpenOptions},
|
||||
io,
|
||||
rc::Rc
|
||||
os::unix::fs::OpenOptionsExt,
|
||||
rc::Rc,
|
||||
};
|
||||
use syscall::{error::*, Error, Map, SchemeMut, Result};
|
||||
use syscall::{error::*, flag::O_NONBLOCK, Error, Map, SchemeMut, Result};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct ShmHandle {
|
||||
@@ -24,7 +25,12 @@ impl ShmScheme {
|
||||
maps: HashMap::new(),
|
||||
handles: HashMap::new(),
|
||||
next_id: 0,
|
||||
socket: File::create(":shm")?
|
||||
socket: OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(true)
|
||||
.custom_flags(O_NONBLOCK as i32)
|
||||
.open(":shm")?
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user