mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
Kernel: Add const variant of Process::perf_events()
This lets us get rid of some const_casts.
This commit is contained in:
parent
ec4b814c9a
commit
6f992d784f
2 changed files with 3 additions and 2 deletions
|
@ -503,6 +503,7 @@ public:
|
||||||
const NonnullRefPtrVector<Thread>& threads_for_coredump(Badge<Coredump>) const { return m_threads_for_coredump; }
|
const NonnullRefPtrVector<Thread>& threads_for_coredump(Badge<Coredump>) const { return m_threads_for_coredump; }
|
||||||
|
|
||||||
PerformanceEventBuffer* perf_events() { return m_perf_event_buffer; }
|
PerformanceEventBuffer* perf_events() { return m_perf_event_buffer; }
|
||||||
|
PerformanceEventBuffer const* perf_events() const { return m_perf_event_buffer; }
|
||||||
|
|
||||||
Memory::AddressSpace& address_space() { return *m_space; }
|
Memory::AddressSpace& address_space() { return *m_space; }
|
||||||
Memory::AddressSpace const& address_space() const { return *m_space; }
|
Memory::AddressSpace const& address_space() const { return *m_space; }
|
||||||
|
|
|
@ -162,11 +162,11 @@ KResult Process::procfs_get_unveil_stats(KBufferBuilder& builder) const
|
||||||
KResult Process::procfs_get_perf_events(KBufferBuilder& builder) const
|
KResult Process::procfs_get_perf_events(KBufferBuilder& builder) const
|
||||||
{
|
{
|
||||||
InterruptDisabler disabler;
|
InterruptDisabler disabler;
|
||||||
if (!const_cast<Process&>(*this).perf_events()) {
|
if (!perf_events()) {
|
||||||
dbgln("ProcFS: No perf events for {}", pid());
|
dbgln("ProcFS: No perf events for {}", pid());
|
||||||
return KResult(ENOBUFS);
|
return KResult(ENOBUFS);
|
||||||
}
|
}
|
||||||
return const_cast<Process&>(*this).perf_events()->to_json(builder) ? KSuccess : KResult(EINVAL);
|
return perf_events()->to_json(builder) ? KSuccess : KResult(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
KResult Process::procfs_get_fds_stats(KBufferBuilder& builder) const
|
KResult Process::procfs_get_fds_stats(KBufferBuilder& builder) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue