Replace syscall::Scheme with KernelScheme.
This commit is contained in:
@@ -20,7 +20,7 @@ use crate::context::memory::AddrSpace;
|
||||
use crate::ipi::{ipi, IpiKind, IpiTarget};
|
||||
use crate::paging::{RmmA, RmmArch};
|
||||
use crate::memory::{RaiiFrame, Frame};
|
||||
use crate::scheme::{SchemeNamespace, FileHandle};
|
||||
use crate::scheme::{SchemeNamespace, FileHandle, CallerCtx};
|
||||
use crate::sync::WaitMap;
|
||||
|
||||
use crate::syscall::data::SigAction;
|
||||
@@ -472,6 +472,9 @@ impl Context {
|
||||
0
|
||||
); 128]))
|
||||
}
|
||||
pub fn caller_ctx(&self) -> CallerCtx {
|
||||
CallerCtx { pid: self.id.into(), uid: self.euid, gid: self.egid }
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper struct for borrowing the syscall head or tail buf.
|
||||
|
||||
+6
-7
@@ -32,7 +32,7 @@ pub struct FileDescriptor {
|
||||
impl FileDescription {
|
||||
/// Try closing a file, although at this point the description will be destroyed anyway, if
|
||||
/// doing so fails.
|
||||
pub fn try_close(self) -> Result<usize> {
|
||||
pub fn try_close(self) -> Result<()> {
|
||||
event::unregister_file(self.scheme, self.number);
|
||||
|
||||
let scheme = Arc::clone(
|
||||
@@ -44,11 +44,10 @@ impl FileDescription {
|
||||
}
|
||||
|
||||
impl FileDescriptor {
|
||||
pub fn close(self) -> Result<usize> {
|
||||
let Ok(file) = Arc::try_unwrap(self.description) else {
|
||||
return Ok(0);
|
||||
};
|
||||
|
||||
file.into_inner().try_close()
|
||||
pub fn close(self) -> Result<()> {
|
||||
if let Ok(file) = Arc::try_unwrap(self.description) {
|
||||
file.into_inner().try_close()?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user