|
@@ -295,6 +295,8 @@ ErrorOr<NonnullRefPtr<Inode>> ProcFSProcessDirectoryInode::lookup(StringView nam
|
|
return TRY(ProcFSProcessSubDirectoryInode::try_create(procfs(), SegmentedProcFSIndex::ProcessSubDirectory::OpenFileDescriptions, associated_pid()));
|
|
return TRY(ProcFSProcessSubDirectoryInode::try_create(procfs(), SegmentedProcFSIndex::ProcessSubDirectory::OpenFileDescriptions, associated_pid()));
|
|
if (name == "stacks"sv)
|
|
if (name == "stacks"sv)
|
|
return TRY(ProcFSProcessSubDirectoryInode::try_create(procfs(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks, associated_pid()));
|
|
return TRY(ProcFSProcessSubDirectoryInode::try_create(procfs(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks, associated_pid()));
|
|
|
|
+ if (name == "children"sv)
|
|
|
|
+ return TRY(ProcFSProcessSubDirectoryInode::try_create(procfs(), SegmentedProcFSIndex::ProcessSubDirectory::Children, associated_pid()));
|
|
if (name == "unveil"sv)
|
|
if (name == "unveil"sv)
|
|
return TRY(ProcFSProcessPropertyInode::try_create_for_pid_property(procfs(), SegmentedProcFSIndex::MainProcessProperty::Unveil, associated_pid()));
|
|
return TRY(ProcFSProcessPropertyInode::try_create_for_pid_property(procfs(), SegmentedProcFSIndex::MainProcessProperty::Unveil, associated_pid()));
|
|
if (name == "pledge"sv)
|
|
if (name == "pledge"sv)
|
|
@@ -367,6 +369,8 @@ ErrorOr<void> ProcFSProcessSubDirectoryInode::traverse_as_directory(Function<Err
|
|
return process->traverse_file_descriptions_directory(procfs().fsid(), move(callback));
|
|
return process->traverse_file_descriptions_directory(procfs().fsid(), move(callback));
|
|
case SegmentedProcFSIndex::ProcessSubDirectory::Stacks:
|
|
case SegmentedProcFSIndex::ProcessSubDirectory::Stacks:
|
|
return process->traverse_stacks_directory(procfs().fsid(), move(callback));
|
|
return process->traverse_stacks_directory(procfs().fsid(), move(callback));
|
|
|
|
+ case SegmentedProcFSIndex::ProcessSubDirectory::Children:
|
|
|
|
+ return process->traverse_children_directory(procfs().fsid(), move(callback));
|
|
default:
|
|
default:
|
|
VERIFY_NOT_REACHED();
|
|
VERIFY_NOT_REACHED();
|
|
}
|
|
}
|
|
@@ -384,6 +388,8 @@ ErrorOr<NonnullRefPtr<Inode>> ProcFSProcessSubDirectoryInode::lookup(StringView
|
|
return process->lookup_file_descriptions_directory(procfs(), name);
|
|
return process->lookup_file_descriptions_directory(procfs(), name);
|
|
case SegmentedProcFSIndex::ProcessSubDirectory::Stacks:
|
|
case SegmentedProcFSIndex::ProcessSubDirectory::Stacks:
|
|
return process->lookup_stacks_directory(procfs(), name);
|
|
return process->lookup_stacks_directory(procfs(), name);
|
|
|
|
+ case SegmentedProcFSIndex::ProcessSubDirectory::Children:
|
|
|
|
+ return process->lookup_children_directory(procfs(), name);
|
|
default:
|
|
default:
|
|
VERIFY_NOT_REACHED();
|
|
VERIFY_NOT_REACHED();
|
|
}
|
|
}
|
|
@@ -401,6 +407,10 @@ ErrorOr<NonnullRefPtr<ProcFSProcessPropertyInode>> ProcFSProcessPropertyInode::t
|
|
{
|
|
{
|
|
return adopt_nonnull_ref_or_enomem(new (nothrow) ProcFSProcessPropertyInode(procfs, main_property_type, pid));
|
|
return adopt_nonnull_ref_or_enomem(new (nothrow) ProcFSProcessPropertyInode(procfs, main_property_type, pid));
|
|
}
|
|
}
|
|
|
|
+ErrorOr<NonnullRefPtr<ProcFSProcessPropertyInode>> ProcFSProcessPropertyInode::try_create_for_child_process_link(ProcFS const& procfs, ProcessID child_pid, ProcessID pid)
|
|
|
|
+{
|
|
|
|
+ return adopt_nonnull_ref_or_enomem(new (nothrow) ProcFSProcessPropertyInode(procfs, child_pid, pid));
|
|
|
|
+}
|
|
|
|
|
|
ProcFSProcessPropertyInode::ProcFSProcessPropertyInode(ProcFS const& procfs, SegmentedProcFSIndex::MainProcessProperty main_property_type, ProcessID pid)
|
|
ProcFSProcessPropertyInode::ProcFSProcessPropertyInode(ProcFS const& procfs, SegmentedProcFSIndex::MainProcessProperty main_property_type, ProcessID pid)
|
|
: ProcFSProcessAssociatedInode(procfs, pid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(pid, main_property_type))
|
|
: ProcFSProcessAssociatedInode(procfs, pid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(pid, main_property_type))
|
|
@@ -423,6 +433,13 @@ ProcFSProcessPropertyInode::ProcFSProcessPropertyInode(ProcFS const& procfs, Thr
|
|
m_possible_data.property_index = thread_stack_index.value();
|
|
m_possible_data.property_index = thread_stack_index.value();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ProcFSProcessPropertyInode::ProcFSProcessPropertyInode(ProcFS const& procfs, ProcessID child_pid, ProcessID pid)
|
|
|
|
+ : ProcFSProcessAssociatedInode(procfs, pid, SegmentedProcFSIndex::build_segmented_index_for_children(pid, child_pid))
|
|
|
|
+ , m_parent_sub_directory_type(SegmentedProcFSIndex::ProcessSubDirectory::Children)
|
|
|
|
+{
|
|
|
|
+ m_possible_data.property_index = child_pid.value();
|
|
|
|
+}
|
|
|
|
+
|
|
ErrorOr<void> ProcFSProcessPropertyInode::attach(OpenFileDescription& description)
|
|
ErrorOr<void> ProcFSProcessPropertyInode::attach(OpenFileDescription& description)
|
|
{
|
|
{
|
|
return refresh_data(description);
|
|
return refresh_data(description);
|
|
@@ -440,6 +457,8 @@ static mode_t determine_procfs_process_inode_mode(SegmentedProcFSIndex::ProcessS
|
|
return S_IFLNK | 0400;
|
|
return S_IFLNK | 0400;
|
|
if (parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Stacks)
|
|
if (parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Stacks)
|
|
return S_IFREG | 0400;
|
|
return S_IFREG | 0400;
|
|
|
|
+ if (parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Children)
|
|
|
|
+ return S_IFLNK | 0400;
|
|
VERIFY(parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Reserved);
|
|
VERIFY(parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Reserved);
|
|
if (main_property == SegmentedProcFSIndex::MainProcessProperty::BinaryLink)
|
|
if (main_property == SegmentedProcFSIndex::MainProcessProperty::BinaryLink)
|
|
return S_IFLNK | 0777;
|
|
return S_IFLNK | 0777;
|
|
@@ -531,6 +550,10 @@ ErrorOr<void> ProcFSProcessPropertyInode::try_to_acquire_data(Process& process,
|
|
TRY(process.procfs_get_thread_stack(m_possible_data.property_index, builder));
|
|
TRY(process.procfs_get_thread_stack(m_possible_data.property_index, builder));
|
|
return {};
|
|
return {};
|
|
}
|
|
}
|
|
|
|
+ if (m_parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Children) {
|
|
|
|
+ TRY(process.procfs_get_child_proccess_link(m_possible_data.property_index, builder));
|
|
|
|
+ return {};
|
|
|
|
+ }
|
|
|
|
|
|
VERIFY(m_parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Reserved);
|
|
VERIFY(m_parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Reserved);
|
|
switch (m_possible_data.property_type) {
|
|
switch (m_possible_data.property_type) {
|