mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
Kernel/ProcFS: Clean dead processes properly
Now we use WeakPtrs to break Ref-counting cycle. Also, we call the prepare_for_deletion method to ensure deleted objects are ready for deletion. This is necessary to ensure we don't keep dead processes, which would become zombies. In addition to that, add some debug prints to aid debug in the future.
This commit is contained in:
parent
5073bf8e75
commit
3344f91fc4
6 changed files with 103 additions and 43 deletions
|
@ -144,9 +144,11 @@ KResultOr<size_t> ProcFSUSBBusFolder::entries_count() const
|
|||
KResult ProcFSUSBBusFolder::traverse_as_directory(unsigned fsid, Function<bool(const FS::DirectoryEntryView&)> callback) const
|
||||
{
|
||||
ScopedSpinLock lock(m_lock);
|
||||
VERIFY(m_parent_folder);
|
||||
auto parent_folder = m_parent_folder.strong_ref();
|
||||
// Note: if the parent folder is null, it means something bad happened as this should not happen for the USB folder.
|
||||
VERIFY(parent_folder);
|
||||
callback({ ".", { fsid, component_index() }, 0 });
|
||||
callback({ "..", { fsid, m_parent_folder->component_index() }, 0 });
|
||||
callback({ "..", { fsid, parent_folder->component_index() }, 0 });
|
||||
|
||||
for (auto& device_node : m_device_nodes) {
|
||||
InodeIdentifier identifier = { fsid, device_node.component_index() };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue