Fix typo in ContextList

This commit is contained in:
Jeremy Soller
2021-03-02 19:57:44 -07:00
parent b8e47f6b8f
commit 47048102ef
2 changed files with 3 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ impl ContextList {
}
/// Get an iterator of all parents
pub fn anchestors(&'_ self, id: ContextId) -> impl Iterator<Item = (ContextId, &Arc<RwLock<Context>>)> + '_ {
pub fn ancestors(&'_ self, id: ContextId) -> impl Iterator<Item = (ContextId, &Arc<RwLock<Context>>)> + '_ {
iter::successors(self.get(id).map(|context| (id, context)), move |(_id, context)| {
let context = context.read();
let id = context.ppid;
@@ -47,6 +47,7 @@ impl ContextList {
pub fn iter(&self) -> ::alloc::collections::btree_map::Iter<ContextId, Arc<RwLock<Context>>> {
self.map.iter()
}
pub fn range(&self, range: impl core::ops::RangeBounds<ContextId>) -> ::alloc::collections::btree_map::Range<'_, ContextId, Arc<RwLock<Context>>> {
self.map.range(range)
}

View File

@@ -258,7 +258,7 @@ impl Scheme for ProcScheme {
// Is it a subprocess of us? In the future, a capability could
// bypass this check.
match contexts.anchestors(target.ppid).find(|&(id, _context)| id == current.id) {
match contexts.ancestors(target.ppid).find(|&(id, _context)| id == current.id) {
Some((id, context)) => {
// Paranoid sanity check, as ptrace security holes
// wouldn't be fun