4#include <cosmos/proc/process.hxx>
5#include <cosmos/proc/ResourceUsage.hxx>
6#include <cosmos/proc/types.hxx>
7#include <cosmos/thread/thread.hxx>
10#include <clues/items/items.hxx>
11#include <clues/SystemCallItem.hxx>
13namespace clues::item {
15class CLUES_API ProcessIDItem :
19 explicit ProcessIDItem(
const ItemType type,
const std::string_view desc) :
23 auto pid()
const {
return m_pid; }
25 std::string
str()
const override {
26 if (m_pid == cosmos::ProcessID::INVALID)
40 cosmos::ProcessID m_pid = cosmos::ProcessID::INVALID;
43class CLUES_API ThreadIDItem :
47 explicit ThreadIDItem(
const ItemType type,
const std::string_view desc =
"thread id") :
51 auto tid()
const {
return m_tid; }
61 cosmos::ThreadID m_tid = cosmos::ThreadID::INVALID;
64class CLUES_API ExitStatusItem :
68 explicit ExitStatusItem(
const ItemType type,
const std::string_view desc) :
72 auto status()
const {
return m_status; }
82 cosmos::ExitStatus m_status = cosmos::ExitStatus::INVALID;
85class CLUES_API WaitOptionsItem :
86 public ValueInParameter {
89 explicit WaitOptionsItem() :
90 ValueInParameter{
"options",
"wait options"} {
93 auto options()
const {
97 std::string
str()
const override;
107 cosmos::WaitFlags m_options;
111class CLUES_API ResourceUsageItem :
112 public PointerOutValue {
115 explicit ResourceUsageItem() :
116 PointerOutValue{
"rusage",
"resource usage"} {
119 std::string
str()
const override;
121 std::optional<const cosmos::ResourceUsage> usage()
const {
130 public cosmos::ResourceUsage {
132 struct rusage& raw() {
136 using cosmos::ResourceUsage::raw;
145 void updateData(
const Tracee &proc)
override;
149 std::optional<ResourceUsage> m_rusage;
153class CLUES_API WaitStatusItem :
154 public PointerToScalar<int> {
157 explicit WaitStatusItem() :
158 PointerToScalar{
"wstatus",
"wait status"} {
161 const std::optional<cosmos::WaitStatus>& status()
const {
167 std::string scalarToString()
const override;
177 m_status = cosmos::WaitStatus{*m_val};
183 std::optional<cosmos::WaitStatus> m_status;
virtual std::string str() const
Returns a human readable string representation of the item.
OTHER valueAs() const
Helper to cast the strongly typed Word m_val to other strong enum types.
SystemCallItem(const ItemType type, const std::string_view short_name={}, const std::string_view long_name={})
Constructs a new SystemCallItem.
Base class for traced processes.
void processValue(const Tracee &) override
Processes the value stored in m_val acc. to the actual item type.
void updateData(const Tracee &tracee) override
Called upon exit of the system call to update possible out parameters.
void processValue(const Tracee &tracee) override
Processes the value stored in m_val acc. to the actual item type.
std::string str() const override
Returns a human readable string representation of the item.
void processValue(const Tracee &) override
Processes the value stored in m_val acc. to the actual item type.
void processValue(const Tracee &) override
Processes the value stored in m_val acc. to the actual item type.
std::string str() const override
Returns a human readable string representation of the item.
void processValue(const Tracee &) override
Processes the value stored in m_val acc. to the actual item type.
std::string str() const override
Returns a human readable string representation of the item.
void processValue(const Tracee &) override
Processes the value stored in m_val acc. to the actual item type.
void updateData(const Tracee &tracee) override
Called upon exit of the system call to update possible out parameters.
void processValue(const Tracee &tracee) override
Processes the value stored in m_val acc. to the actual item type.
ItemType
Basic type of a SystemCallItem.