1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

Kernel: Create /proc/pid/cmdline to expose process arguments in procfs

In typical serenity style, they are just a JSON array
This commit is contained in:
Andrew Kaster 2022-06-12 23:04:35 -06:00 committed by Andreas Kling
parent ad0a001f0a
commit 940be19259
5 changed files with 17 additions and 0 deletions

View file

@ -314,6 +314,16 @@ ErrorOr<void> Process::procfs_get_current_work_directory_link(KBufferBuilder& bu
return builder.append(TRY(const_cast<Process&>(*this).current_directory()->try_serialize_absolute_path())->view());
}
ErrorOr<void> Process::procfs_get_command_line(KBufferBuilder& builder) const
{
auto array = TRY(JsonArraySerializer<>::try_create(builder));
for (auto const& arg : arguments()) {
TRY(array.add(arg.view()));
}
TRY(array.finish());
return {};
}
mode_t Process::binary_link_required_mode() const
{
if (!executable())