mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +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
Notes:
sideshowbarker
2024-07-18 11:08:13 +09:00
Author: https://github.com/supercomputer7
Commit: 3344f91fc4
Pull-request: https://github.com/SerenityOS/serenity/pull/8241
Issue: https://github.com/SerenityOS/serenity/issues/6948
Issue: https://github.com/SerenityOS/serenity/issues/7445
Issue: https://github.com/SerenityOS/serenity/issues/8331
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/awesomekling
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