Substitute SgxRwLock with RwLock
This commit is contained in:
parent
4f965fd8db
commit
3d70ca9355
@ -6,7 +6,7 @@ pub struct INodeFile {
|
|||||||
abs_path: String,
|
abs_path: String,
|
||||||
offset: SgxMutex<usize>,
|
offset: SgxMutex<usize>,
|
||||||
access_mode: AccessMode,
|
access_mode: AccessMode,
|
||||||
status_flags: SgxRwLock<StatusFlags>,
|
status_flags: RwLock<StatusFlags>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl File for INodeFile {
|
impl File for INodeFile {
|
||||||
@ -216,7 +216,7 @@ impl INodeFile {
|
|||||||
abs_path: abs_path.to_owned(),
|
abs_path: abs_path.to_owned(),
|
||||||
offset: SgxMutex::new(0),
|
offset: SgxMutex::new(0),
|
||||||
access_mode,
|
access_mode,
|
||||||
status_flags: SgxRwLock::new(status_flags),
|
status_flags: RwLock::new(status_flags),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,11 +21,11 @@ impl Pipe {
|
|||||||
Ok(Pipe {
|
Ok(Pipe {
|
||||||
reader: PipeReader {
|
reader: PipeReader {
|
||||||
inner: SgxMutex::new(ring_buf.reader),
|
inner: SgxMutex::new(ring_buf.reader),
|
||||||
status_flags: SgxRwLock::new(valid_flags),
|
status_flags: RwLock::new(valid_flags),
|
||||||
},
|
},
|
||||||
writer: PipeWriter {
|
writer: PipeWriter {
|
||||||
inner: SgxMutex::new(ring_buf.writer),
|
inner: SgxMutex::new(ring_buf.writer),
|
||||||
status_flags: SgxRwLock::new(valid_flags),
|
status_flags: RwLock::new(valid_flags),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ impl Pipe {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct PipeReader {
|
pub struct PipeReader {
|
||||||
inner: SgxMutex<RingBufReader>,
|
inner: SgxMutex<RingBufReader>,
|
||||||
status_flags: SgxRwLock<StatusFlags>,
|
status_flags: RwLock<StatusFlags>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl File for PipeReader {
|
impl File for PipeReader {
|
||||||
@ -95,7 +95,7 @@ unsafe impl Sync for PipeReader {}
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct PipeWriter {
|
pub struct PipeWriter {
|
||||||
inner: SgxMutex<RingBufWriter>,
|
inner: SgxMutex<RingBufWriter>,
|
||||||
status_flags: SgxRwLock<StatusFlags>,
|
status_flags: RwLock<StatusFlags>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl File for PipeWriter {
|
impl File for PipeWriter {
|
||||||
|
@ -97,9 +97,9 @@ impl ProcessBuilder {
|
|||||||
// Build a new process
|
// Build a new process
|
||||||
let new_process = {
|
let new_process = {
|
||||||
let exec_path = self.exec_path.take().unwrap_or_default();
|
let exec_path = self.exec_path.take().unwrap_or_default();
|
||||||
let parent = self.parent.take().map(|parent| SgxRwLock::new(parent));
|
let parent = self.parent.take().map(|parent| RwLock::new(parent));
|
||||||
let inner = SgxMutex::new(ProcessInner::new());
|
let inner = SgxMutex::new(ProcessInner::new());
|
||||||
let sig_dispositions = SgxRwLock::new(SigDispositions::new());
|
let sig_dispositions = RwLock::new(SigDispositions::new());
|
||||||
let sig_queues = RwLock::new(SigQueues::new());
|
let sig_queues = RwLock::new(SigQueues::new());
|
||||||
let forced_exit_status = ForcedExitStatus::new();
|
let forced_exit_status = ForcedExitStatus::new();
|
||||||
Arc::new(Process {
|
Arc::new(Process {
|
||||||
|
@ -16,10 +16,10 @@ pub struct Process {
|
|||||||
pid: pid_t,
|
pid: pid_t,
|
||||||
exec_path: String,
|
exec_path: String,
|
||||||
// Mutable info
|
// Mutable info
|
||||||
parent: Option<SgxRwLock<ProcessRef>>,
|
parent: Option<RwLock<ProcessRef>>,
|
||||||
inner: SgxMutex<ProcessInner>,
|
inner: SgxMutex<ProcessInner>,
|
||||||
// Signal
|
// Signal
|
||||||
sig_dispositions: SgxRwLock<SigDispositions>,
|
sig_dispositions: RwLock<SigDispositions>,
|
||||||
sig_queues: RwLock<SigQueues>,
|
sig_queues: RwLock<SigQueues>,
|
||||||
forced_exit_status: ForcedExitStatus,
|
forced_exit_status: ForcedExitStatus,
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ impl Process {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get the process-wide signal dispositions.
|
/// Get the process-wide signal dispositions.
|
||||||
pub fn sig_dispositions(&self) -> &SgxRwLock<SigDispositions> {
|
pub fn sig_dispositions(&self) -> &RwLock<SigDispositions> {
|
||||||
&self.sig_dispositions
|
&self.sig_dispositions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ impl ThreadBuilder {
|
|||||||
.task
|
.task
|
||||||
.ok_or_else(|| errno!(EINVAL, "task is mandatory"))?;
|
.ok_or_else(|| errno!(EINVAL, "task is mandatory"))?;
|
||||||
let tid = self.tid.unwrap_or_else(|| ThreadId::new());
|
let tid = self.tid.unwrap_or_else(|| ThreadId::new());
|
||||||
let clear_ctid = SgxRwLock::new(self.clear_ctid);
|
let clear_ctid = RwLock::new(self.clear_ctid);
|
||||||
let inner = SgxMutex::new(ThreadInner::new());
|
let inner = SgxMutex::new(ThreadInner::new());
|
||||||
let process = self
|
let process = self
|
||||||
.process
|
.process
|
||||||
@ -106,10 +106,10 @@ impl ThreadBuilder {
|
|||||||
let files = self.files.unwrap_or_default();
|
let files = self.files.unwrap_or_default();
|
||||||
let sched = self.sched.unwrap_or_default();
|
let sched = self.sched.unwrap_or_default();
|
||||||
let rlimits = self.rlimits.unwrap_or_default();
|
let rlimits = self.rlimits.unwrap_or_default();
|
||||||
let name = SgxRwLock::new(self.name.unwrap_or_default());
|
let name = RwLock::new(self.name.unwrap_or_default());
|
||||||
let sig_queues = RwLock::new(SigQueues::new());
|
let sig_queues = RwLock::new(SigQueues::new());
|
||||||
let sig_mask = SgxRwLock::new(SigSet::new_empty());
|
let sig_mask = RwLock::new(SigSet::new_empty());
|
||||||
let sig_tmp_mask = SgxRwLock::new(SigSet::new_empty());
|
let sig_tmp_mask = RwLock::new(SigSet::new_empty());
|
||||||
let sig_stack = SgxMutex::new(None);
|
let sig_stack = SgxMutex::new(None);
|
||||||
let profiler = if cfg!(feature = "syscall_timing") {
|
let profiler = if cfg!(feature = "syscall_timing") {
|
||||||
SgxMutex::new(Some(ThreadProfiler::new()))
|
SgxMutex::new(Some(ThreadProfiler::new()))
|
||||||
|
@ -24,9 +24,9 @@ pub struct Thread {
|
|||||||
// Immutable info
|
// Immutable info
|
||||||
tid: ThreadId,
|
tid: ThreadId,
|
||||||
// Mutable info
|
// Mutable info
|
||||||
clear_ctid: SgxRwLock<Option<NonNull<pid_t>>>,
|
clear_ctid: RwLock<Option<NonNull<pid_t>>>,
|
||||||
inner: SgxMutex<ThreadInner>,
|
inner: SgxMutex<ThreadInner>,
|
||||||
name: SgxRwLock<ThreadName>,
|
name: RwLock<ThreadName>,
|
||||||
// Process
|
// Process
|
||||||
process: ProcessRef,
|
process: ProcessRef,
|
||||||
// Resources
|
// Resources
|
||||||
@ -37,8 +37,8 @@ pub struct Thread {
|
|||||||
rlimits: ResourceLimitsRef,
|
rlimits: ResourceLimitsRef,
|
||||||
// Signal
|
// Signal
|
||||||
sig_queues: RwLock<SigQueues>,
|
sig_queues: RwLock<SigQueues>,
|
||||||
sig_mask: SgxRwLock<SigSet>,
|
sig_mask: RwLock<SigSet>,
|
||||||
sig_tmp_mask: SgxRwLock<SigSet>,
|
sig_tmp_mask: RwLock<SigSet>,
|
||||||
sig_stack: SgxMutex<Option<SigStack>>,
|
sig_stack: SgxMutex<Option<SigStack>>,
|
||||||
// System call timing
|
// System call timing
|
||||||
profiler: SgxMutex<Option<ThreadProfiler>>,
|
profiler: SgxMutex<Option<ThreadProfiler>>,
|
||||||
@ -86,7 +86,7 @@ impl Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get the per-thread signal mask.
|
/// Get the per-thread signal mask.
|
||||||
pub fn sig_mask(&self) -> &SgxRwLock<SigSet> {
|
pub fn sig_mask(&self) -> &RwLock<SigSet> {
|
||||||
&self.sig_mask
|
&self.sig_mask
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ impl Thread {
|
|||||||
///
|
///
|
||||||
/// The tmp mask is always cleared at the end of the execution
|
/// The tmp mask is always cleared at the end of the execution
|
||||||
/// of a syscall.
|
/// of a syscall.
|
||||||
pub fn sig_tmp_mask(&self) -> &SgxRwLock<SigSet> {
|
pub fn sig_tmp_mask(&self) -> &RwLock<SigSet> {
|
||||||
&self.sig_tmp_mask
|
&self.sig_tmp_mask
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user