1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 06:17:35 +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

@ -311,6 +311,8 @@ ErrorOr<NonnullRefPtr<Inode>> ProcFSProcessDirectoryInode::lookup(StringView nam
return TRY(ProcFSProcessPropertyInode::try_create_for_pid_property(procfs(), SegmentedProcFSIndex::MainProcessProperty::PerformanceEvents, associated_pid()));
if (name == "vm"sv)
return TRY(ProcFSProcessPropertyInode::try_create_for_pid_property(procfs(), SegmentedProcFSIndex::MainProcessProperty::VirtualMemoryStats, associated_pid()));
if (name == "cmdline"sv)
return TRY(ProcFSProcessPropertyInode::try_create_for_pid_property(procfs(), SegmentedProcFSIndex::MainProcessProperty::CommandLine, associated_pid()));
return ENOENT;
}
@ -571,6 +573,8 @@ ErrorOr<void> ProcFSProcessPropertyInode::try_to_acquire_data(Process& process,
return process.procfs_get_perf_events(builder);
case SegmentedProcFSIndex::MainProcessProperty::VirtualMemoryStats:
return process.procfs_get_virtual_memory_stats(builder);
case SegmentedProcFSIndex::MainProcessProperty::CommandLine:
return process.procfs_get_command_line(builder);
default:
VERIFY_NOT_REACHED();
}