libsysprof-analyze: use pid list to load mountinfo

This commit is contained in:
Christian Hergert
2023-05-11 15:02:52 -07:00
parent 971166a82f
commit 1f9d37837d

View File

@ -347,7 +347,7 @@ sysprof_document_load_mountinfo (SysprofDocument *self,
g_assert (contents != NULL); g_assert (contents != NULL);
g_assert (contents[contents_len] == 0); g_assert (contents[contents_len] == 0);
process_info = _sysprof_document_process_info (self, pid, FALSE); process_info = _sysprof_document_process_info (self, pid, TRUE);
g_assert (process_info != NULL); g_assert (process_info != NULL);
g_assert (process_info->mount_namespace != NULL); g_assert (process_info->mount_namespace != NULL);
@ -367,23 +367,26 @@ sysprof_document_load_mountinfo (SysprofDocument *self,
static void static void
sysprof_document_load_mountinfos (SysprofDocument *self) sysprof_document_load_mountinfos (SysprofDocument *self)
{ {
GHashTableIter hiter; GtkBitsetIter iter;
gpointer key, value; guint pid;
g_assert (SYSPROF_IS_DOCUMENT (self)); g_assert (SYSPROF_IS_DOCUMENT (self));
g_hash_table_iter_init (&hiter, self->pid_to_process_info); if (gtk_bitset_iter_init_first (&iter, self->pids, &pid))
while (g_hash_table_iter_next (&hiter, &key, &value))
{ {
int pid = GPOINTER_TO_INT (key); do
g_autofree char *path = g_strdup_printf ("/proc/%d/mountinfo", pid);
g_autoptr(SysprofDocumentFile) file = sysprof_document_lookup_file (self, path);
if (file != NULL)
{ {
g_autoptr(GBytes) bytes = sysprof_document_file_dup_bytes (file); g_autofree char *path = g_strdup_printf ("/proc/%u/mountinfo", pid);
sysprof_document_load_mountinfo (self, pid, bytes); g_autoptr(SysprofDocumentFile) file = sysprof_document_lookup_file (self, path);
if (file != NULL)
{
g_autoptr(GBytes) bytes = sysprof_document_file_dup_bytes (file);
sysprof_document_load_mountinfo (self, pid, bytes);
}
} }
while (gtk_bitset_iter_next (&iter, &pid));
} }
} }