1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:48:12 +00:00

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
parent 45a5cf95f9
commit 1ea604adb1

View file

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