8#include <cosmos/fs/FileDescriptor.hxx>
9#include <cosmos/fs/FileLock.hxx>
10#include <cosmos/utils.hxx>
13#include <clues/items/items.hxx>
15namespace clues::item {
17class CLUES_API FcntlOperation :
22 ValueInParameter{
"op",
"operation"} {
28 DUPFD_CLOEXEC = F_DUPFD_CLOEXEC,
45 OFD_SETLK = F_OFD_SETLK,
46 OFD_SETLKW = F_OFD_SETLKW,
47 OFD_GETLK = F_OFD_GETLK,
50 GETOWN_EX = F_GETOWN_EX,
51 SETOWN_EX = F_SETOWN_EX,
54 SETLEASE = F_SETLEASE,
55 GETLEASE = F_GETLEASE,
57 SETPIPE_SZ = F_SETPIPE_SZ,
58 GETPIPE_SZ = F_GETPIPE_SZ,
59 ADD_SEALS = F_ADD_SEALS,
60 GET_SEALS = F_GET_SEALS,
61 GET_RW_HINT = F_GET_RW_HINT,
62 SET_RW_HINT = F_SET_RW_HINT,
63 GET_FILE_RW_HINT = F_GET_FILE_RW_HINT,
64 SET_FILE_RW_HINT = F_SET_FILE_RW_HINT,
66 INVALID = std::numeric_limits<int>::max()
73 std::string str()
const override;
75 Oper operation()
const {
81 return cosmos::in_list(m_op, {Oper::GETLK64, Oper::SETLK64, Oper::SETLKW64});
86 void processValue(
const Tracee &proc)
override;
94struct CLUES_API FileDescFlagsValue :
96 explicit FileDescFlagsValue(
ItemType type) :
100 std::string
str()
const override;
102 cosmos::FileDescriptor::DescFlags flags()
const {
112 cosmos::FileDescriptor::DescFlags m_flags;
116class CLUES_API FLockParameter :
117 public PointerValue {
119 explicit FLockParameter() :
125 std::string
str()
const override;
132 const std::optional<cosmos::FileLock>&
lock()
const {
138 void processValue(
const Tracee &proc)
override;
140 void updateData(
const Tracee &proc)
override;
144 std::optional<cosmos::FileLock> m_lock;
153class CLUES_API FileDescOwner :
157 explicit FileDescOwner(
const ItemType type) :
161 std::string
str()
const override;
163 std::optional<cosmos::ProcessID> pid()
const {
167 std::optional<cosmos::ProcessGroupID> pgid()
const {
172 return m_pid.has_value();
175 bool isPgid()
const {
176 return m_pgid.has_value();
185 std::optional<cosmos::ProcessID> m_pid;
186 std::optional<cosmos::ProcessGroupID> m_pgid;
190class CLUES_API ExtFileDescOwner :
193 explicit ExtFileDescOwner(
const ItemType type) :
197 std::string
str()
const override;
199 const std::optional<cosmos::FileDescriptor::Owner>& owner()
const {
209 std::optional<cosmos::FileDescriptor::Owner> m_owner;
213class CLUES_API LeaseType :
217 explicit LeaseType(
const ItemType type) :
221 std::string
str()
const override;
223 auto& lease()
const {
233 cosmos::FileDescriptor::LeaseType m_lease{std::numeric_limits<int>::max()};
237class CLUES_API DNotifySettings :
238 public ValueInParameter {
241 enum class Setting :
int {
252 using Settings = cosmos::BitMask<Setting>;
256 explicit DNotifySettings() :
257 ValueInParameter{
"events",
"dnotify event bitmask"} {
260 auto settings()
const {
264 std::string
str()
const override;
276class CLUES_API FileSealSettings :
277 public ValueParameter {
280 explicit FileSealSettings(
const ItemType type) :
281 ValueParameter{type,
"flags",
"seal flags"} {
289 std::string str()
const override;
293 void processValue(
const Tracee &proc)
override;
297 cosmos::FileDescriptor::SealFlags m_flags;
308class CLUES_API ReadWriteHint :
312 using Hint = cosmos::FileDescriptor::ReadWriteHint;
316 explicit ReadWriteHint(
const ItemType type) :
324 std::string
str()
const override;
332 Hint m_hint = Hint::LIFE_NOT_SET;
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.
std::string str() const override
Returns a human readable string representation of the item.
void processValue(const Tracee &proc) override
Processes the value stored in m_val acc. to the actual item type.
void processValue(const Tracee &proc) 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.
const std::optional< cosmos::FileLock > & lock() const
Access to the extracted FileLock data.
std::string str() const override
Returns a human readable string representation of the item.
bool isLock64() const
Returns whether the operation is one of the LK64 operations.
Oper
All possible arguments for the op parameter to fcntl(2).
std::string str() const override
Returns a human readable string representation of the item.
void processValue(const Tracee &proc) override
Processes the value stored in m_val acc. to the actual item type.
auto flags() const
Returns the currently stored SealFlags.
std::string str() const override
Returns a human readable string representation of the item.
void processValue(const Tracee &proc) override
Processes the value stored in m_val acc. to the actual item type.
void processValue(const Tracee &proc) 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.
Specialization of ValueParameter for PARAM_IN parameters.
ItemType
Basic type of a SystemCallItem.
@ PARAM_IN_OUT
Both an input and output parameter.
std::string str() const override
Returns a human readable string representation of the item.
void processValue(const Tracee &proc) override
Processes the value stored in m_val acc. to the actual item type.