mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-31 15:32:51 +00:00
SystemMonitor: Show process unveil() state as "Veil"
A process has one of three veil states: - None: unveil() has never been called. - Dropped: unveil() has been called, and can be called again. - Locked: unveil() has been called, and cannot be called again.
This commit is contained in:
parent
edf509c19e
commit
66598f60fe
Notes:
sideshowbarker
2024-07-19 09:54:45 +09:00
Author: https://github.com/awesomekling
Commit: 66598f60fe
5 changed files with 25 additions and 1 deletions
|
@ -121,6 +121,8 @@ String ProcessModel::column_name(int column) const
|
|||
return "File Out";
|
||||
case Column::Pledge:
|
||||
return "Pledge";
|
||||
case Column::Veil:
|
||||
return "Veil";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
@ -181,6 +183,8 @@ GModel::ColumnMetadata ProcessModel::column_metadata(int column) const
|
|||
return { 60, TextAlignment::CenterRight };
|
||||
case Column::Pledge:
|
||||
return { 60, TextAlignment::CenterLeft };
|
||||
case Column::Veil:
|
||||
return { 60, TextAlignment::CenterLeft };
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
@ -252,6 +256,8 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
|
|||
return thread.current_state.file_write_bytes;
|
||||
case Column::Pledge:
|
||||
return thread.current_state.pledge;
|
||||
case Column::Veil:
|
||||
return thread.current_state.veil;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
return {};
|
||||
|
@ -319,6 +325,8 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
|
|||
return thread.current_state.file_write_bytes;
|
||||
case Column::Pledge:
|
||||
return thread.current_state.pledge;
|
||||
case Column::Veil:
|
||||
return thread.current_state.veil;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,6 +349,7 @@ void ProcessModel::update()
|
|||
state.pid = it.value.pid;
|
||||
state.user = it.value.username;
|
||||
state.pledge = it.value.pledge;
|
||||
state.veil = it.value.veil;
|
||||
state.syscall_count = thread.syscall_count;
|
||||
state.inode_faults = thread.inode_faults;
|
||||
state.zero_faults = thread.zero_faults;
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
CleanInode,
|
||||
PurgeableVolatile,
|
||||
PurgeableNonvolatile,
|
||||
Veil,
|
||||
Pledge,
|
||||
Syscalls,
|
||||
InodeFaults,
|
||||
|
@ -100,6 +101,7 @@ private:
|
|||
String state;
|
||||
String user;
|
||||
String pledge;
|
||||
String veil;
|
||||
u32 priority;
|
||||
u32 effective_priority;
|
||||
size_t amount_virtual;
|
||||
|
|
|
@ -822,6 +822,18 @@ Optional<KBuffer> procfs$all(InodeIdentifier)
|
|||
|
||||
process_object.add("pledge", pledge_builder.to_string());
|
||||
|
||||
switch (process.unveil_state()) {
|
||||
case UnveilState::None:
|
||||
process_object.add("veil", "None");
|
||||
break;
|
||||
case UnveilState::VeilDropped:
|
||||
process_object.add("veil", "Dropped");
|
||||
break;
|
||||
case UnveilState::VeilLocked:
|
||||
process_object.add("veil", "Locked");
|
||||
break;
|
||||
}
|
||||
|
||||
process_object.add("pid", process.pid());
|
||||
process_object.add("pgid", process.tty() ? process.tty()->pgid() : 0);
|
||||
process_object.add("pgp", process.pgid());
|
||||
|
@ -1531,7 +1543,6 @@ size_t ProcFSProxyInode::directory_entry_count() const
|
|||
return m_fd->inode()->directory_entry_count();
|
||||
}
|
||||
|
||||
|
||||
KResult ProcFSInode::add_child(InodeIdentifier child_id, const StringView& name, mode_t)
|
||||
{
|
||||
(void)child_id;
|
||||
|
|
|
@ -62,6 +62,7 @@ HashMap<pid_t, CProcessStatistics> CProcessStatisticsReader::get_all()
|
|||
process.name = process_object.get("name").to_string();
|
||||
process.tty = process_object.get("tty").to_string();
|
||||
process.pledge = process_object.get("pledge").to_string();
|
||||
process.veil = process_object.get("veil").to_string();
|
||||
process.amount_virtual = process_object.get("amount_virtual").to_u32();
|
||||
process.amount_resident = process_object.get("amount_resident").to_u32();
|
||||
process.amount_shared = process_object.get("amount_shared").to_u32();
|
||||
|
|
|
@ -64,6 +64,7 @@ struct CProcessStatistics {
|
|||
String name;
|
||||
String tty;
|
||||
String pledge;
|
||||
String veil;
|
||||
size_t amount_virtual;
|
||||
size_t amount_resident;
|
||||
size_t amount_shared;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue