Kernel/ProcFS: Avoid String allocation when traversing /proc/PID/fd/

This commit is contained in:
Andreas Kling 2021-08-17 01:15:34 +02:00
commit 1ea604adb1
Notes: sideshowbarker 2024-07-18 05:35:31 +09:00

View file

@ -97,8 +97,9 @@ KResult Process::traverse_file_descriptions_directory(unsigned fsid, Function<bo
count++; count++;
return; return;
} }
InodeIdentifier identifier = { fsid, SegmentedProcFSIndex::build_segmented_index_for_file_description(pid(), count) }; StringBuilder builder;
callback({ String::number(count), identifier, 0 }); builder.appendff("{}", count);
callback({ builder.string_view(), { fsid, SegmentedProcFSIndex::build_segmented_index_for_file_description(pid(), count) }, 0 });
count++; count++;
}); });
return KSuccess; return KSuccess;