libclues
Linux C++ Tracing Library
Loading...
Searching...
No Matches
signal.hxx
1#pragma once
2
3// C++
4#include <optional>
5
6// cosmos
7#include <cosmos/proc/types.hxx>
8#include <cosmos/proc/SigAction.hxx>
9
10// clues
11#include <clues/items/items.hxx>
12
13namespace clues::item {
14
16class CLUES_API SigSetOperation :
17 public ValueInParameter {
18public: // types
19
20 enum class Op : int {
21 BLOCK = SIG_BLOCK,
22 UNBLOCK = SIG_UNBLOCK,
23 SETMASK = SIG_SETMASK,
24 INVALID
25 };
26
27public:
28 explicit SigSetOperation() :
29 ValueInParameter{"sigsetop", "signal set operation"} {
30 }
31
32 std::string str() const override;
33
34 auto op() const {
35 return m_op;
36 }
37
38protected: // functions
39
40 void processValue(const Tracee&) override {
41 m_op = valueAs<Op>();
42 }
43
44protected: // data
45
46 Op m_op = Op::INVALID;
47};
48
50class CLUES_API SignalNumber :
51 public ValueParameter {
52public: // functions
53 explicit SignalNumber(const ItemType type = ItemType::PARAM_IN) :
54 ValueParameter{type, "signum", "signal number"} {
55 }
56
57 std::string str() const override;
58
59 auto nr() const {
60 return m_nr;
61 }
62
63protected: // functions
64
65 void processValue(const Tracee&) override {
67 }
68
69protected: // data
70
71 cosmos::SignalNr m_nr = cosmos::SignalNr::NONE;
72};
73
75class CLUES_API SigActionParameter :
76 public PointerValue {
77public: // functions
78 explicit SigActionParameter(
79 const std::string_view short_name = "sigaction",
80 const std::string_view long_name = "struct sigaction",
81 const ItemType type = ItemType::PARAM_IN) :
82 PointerValue{type, short_name, long_name} {
83 }
84
85 std::string str() const override;
86
87 const std::optional<cosmos::SigAction>& action() const {
88 return m_sigaction;
89 }
90
91protected: // functions
92
93 void processValue(const Tracee &proc) override;
94
95protected: // data
96
97 std::optional<cosmos::SigAction> m_sigaction;
98};
99
101class CLUES_API SigSetParameter :
102 public PointerValue {
103public: // functions
104
105 explicit SigSetParameter(
106 const ItemType type = ItemType::PARAM_IN,
107 const std::string_view short_name = "sigset", const std::string_view name = "signal set") :
108 PointerValue{type, short_name, name} {
109 }
110
111 std::string str() const override;
112
113 const std::optional<cosmos::SigSet>& sigset() const {
114 return m_sigset;
115 }
116
117protected: // functions
118
119 void processValue(const Tracee &proc) override;
120
121protected: // data
122
123 std::optional<cosmos::SigSet> m_sigset;
124};
125
126} // end ns
OTHER valueAs() const
Helper to cast the strongly typed Word m_val to other strong enum types.
Base class for traced processes.
Definition Tracee.hxx:39
std::string str() const override
Returns a human readable string representation of the item.
Definition signal.cxx:36
void processValue(const Tracee &proc) override
Processes the value stored in m_val acc. to the actual item type.
Definition signal.cxx:119
The operation to performed on a signal set.
Definition signal.hxx:17
void processValue(const Tracee &) override
Processes the value stored in m_val acc. to the actual item type.
Definition signal.hxx:40
@ BLOCK
additionally block.
Definition signal.hxx:21
@ SETMASK
replace the whole mask.
Definition signal.hxx:23
@ UNBLOCK
unblock the given signals.
Definition signal.hxx:22
std::string str() const override
Returns a human readable string representation of the item.
Definition signal.cxx:176
void processValue(const Tracee &proc) override
Processes the value stored in m_val acc. to the actual item type.
Definition signal.cxx:149
std::string str() const override
Returns a human readable string representation of the item.
Definition signal.cxx:25
void processValue(const Tracee &) override
Processes the value stored in m_val acc. to the actual item type.
Definition signal.hxx:65
Specialization of ValueParameter for PARAM_IN parameters.
Definition items.hxx:47
ItemType
Basic type of a SystemCallItem.
@ PARAM_IN
An input parameter to the system call.