diff --git a/zion/capability/capability_table.cpp b/zion/capability/capability_table.cpp index 1036679..6dc78fd 100644 --- a/zion/capability/capability_table.cpp +++ b/zion/capability/capability_table.cpp @@ -33,3 +33,13 @@ glcr::RefPtr CapabilityTable::ReleaseCapability(uint64_t id) { (void)capabilities_.Delete(id); return cap; } + +void CapabilityTable::ReleaseAll() { + for (uint64_t i = 0; i < next_cap_id_; i++) { + (void)capabilities_.Delete(i); + } + if (capabilities_.size() != 0) { + dbgln("Capabilities still remaining after clear: {x}", + capabilities_.size()); + } +} diff --git a/zion/capability/capability_table.h b/zion/capability/capability_table.h index a67112c..a29e4b2 100644 --- a/zion/capability/capability_table.h +++ b/zion/capability/capability_table.h @@ -25,6 +25,8 @@ class CapabilityTable { glcr::RefPtr GetCapability(uint64_t id); glcr::RefPtr ReleaseCapability(uint64_t id); + void ReleaseAll(); + private: glcr::RefPtr lock_ = Mutex::Create(); // TODO: Do some randomization. diff --git a/zion/object/process.cpp b/zion/object/process.cpp index 56e72e9..55e73ed 100644 --- a/zion/object/process.cpp +++ b/zion/object/process.cpp @@ -98,7 +98,8 @@ void Process::Cleanup() { } } - // 2. Release all capabailities. TODO + // 2. Release all capabailities. + caps_.ReleaseAll(); // 3. Unmap all user memory. TODO