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