libclues
Linux C++ Tracing Library
Loading...
Searching...
No Matches
clues::item::ExtFileDescOwner Class Reference

The structure used with the F_GETOWN_EX and F_SETOWN_EX fcntl() operations. More...

#include <fcntl.hxx>

+ Inheritance diagram for clues::item::ExtFileDescOwner:

Public Member Functions

 ExtFileDescOwner (const ItemType type)
 
std::string str () const override
 Returns a human readable string representation of the item.
 
const std::optional< cosmos::FileDescriptor::Owner > & owner () const
 
- Public Member Functions inherited from clues::SystemCallItem
 SystemCallItem (const ItemType type, const std::string_view short_name={}, const std::string_view long_name={})
 Constructs a new SystemCallItem.
 
auto type () const
 
bool isIn () const
 
bool isOut () const
 
bool isInOut () const
 
bool isReturnValue () const
 
void fill (const Tracee &proc, const Word word)
 Fills the item from the given register data.
 
bool needsUpdate () const
 Returns whether the item needs to be updated after the system call is finished.
 
std::string_view shortName () const
 Returns the friendly short name for this item.
 
std::string_view longName () const
 Returns the friendly long name for this item, if available, else the short name.
 
auto hasLongName () const
 
bool isZero () const
 Returns whether the parameter is set to 0 / NULL.
 
Word value () const
 Returns the currently stored raw value of the item.
 
template<typename OTHER>
OTHER valueAs () const
 Helper to cast the strongly typed Word m_val to other strong enum types.
 
ForeignPtr asPtr () const
 
Flags flags () const
 
bool deferFill () const
 

Protected Member Functions

void processValue (const Tracee &proc) override
 Processes the value stored in m_val acc. to the actual item type.
 
- Protected Member Functions inherited from clues::SystemCallItem
virtual void updateData (const Tracee &t)
 Called upon exit of the system call to update possible out parameters.
 
void setSystemCall (const SystemCall &sc)
 Sets the system call context this item is a part of.
 

Protected Attributes

std::optional< cosmos::FileDescriptor::Owner > m_owner
 
- Protected Attributes inherited from clues::SystemCallItem
const SystemCallm_call = nullptr
 The system call context this item part of.
 
const ItemType m_type
 The type of item.
 
std::string_view m_short_name
 A human readable short name for the item, should be one word only.
 
std::string_view m_long_name
 A human readable longer name for the item.
 
Word m_val
 The raw register value for the item.
 
Flags m_flags
 Flags influencing the processing of the item.
 

Additional Inherited Members

- Public Types inherited from clues::SystemCallItem
enum class  Flag { DEFER_FILL = 1 << 0 }
 
using Flags = cosmos::BitMask<Flag>
 

Detailed Description

The structure used with the F_GETOWN_EX and F_SETOWN_EX fcntl() operations.

Definition at line 190 of file fcntl.hxx.

Constructor & Destructor Documentation

◆ ExtFileDescOwner()

clues::item::ExtFileDescOwner::ExtFileDescOwner ( const ItemType type)
inlineexplicit

Definition at line 193 of file fcntl.hxx.

193 :
194 SystemCallItem{type, "owner_ex", "struct f_owner_ex"} {
195 }
SystemCallItem(const ItemType type, const std::string_view short_name={}, const std::string_view long_name={})
Constructs a new SystemCallItem.

Member Function Documentation

◆ owner()

const std::optional< cosmos::FileDescriptor::Owner > & clues::item::ExtFileDescOwner::owner ( ) const
inline

Definition at line 199 of file fcntl.hxx.

199 {
200 return m_owner;
201 }

◆ processValue()

void clues::item::ExtFileDescOwner::processValue ( const Tracee & )
overrideprotectedvirtual

Processes the value stored in m_val acc. to the actual item type.

This function is called for all parameter types upon entry to a system call, and for ItemType::RETVAL upon exit from a system call.

For parameters of ItemType::PARAM_OUT this callback can be used to reset any stored data to be filled in later when updateData() is called.

Reimplemented from clues::SystemCallItem.

Definition at line 345 of file fcntl.cxx.

345 {
346 m_owner = cosmos::FileDescriptor::Owner{};
347
348 if (!proc.readStruct(asPtr(), *m_owner->raw())) {
349 m_owner.reset();
350 }
351}

◆ str()

std::string clues::item::ExtFileDescOwner::str ( ) const
overridevirtual

Returns a human readable string representation of the item.

This member function should be specialized in derived classes to output the item's data in a fashion suitable for the concrete item type.

Reimplemented from clues::SystemCallItem.

Definition at line 326 of file fcntl.cxx.

326 {
327 if (!m_owner) {
328 return "<invalid>";
329 }
330
331 auto type_str = [](cosmos::FileDescriptor::Owner::Type type) {
332 switch (cosmos::to_integral(type)) {
333 CASE_ENUM_TO_STR(F_OWNER_TID);
334 CASE_ENUM_TO_STR(F_OWNER_PID);
335 CASE_ENUM_TO_STR(F_OWNER_PGRP);
336 default: return "???";
337 }
338 };
339
340 std::stringstream ss;
341 ss << "{type=" << type_str(m_owner->type()) << ", id=" << m_owner->raw()->pid << "}";
342 return ss.str();
343}

Member Data Documentation

◆ m_owner

std::optional<cosmos::FileDescriptor::Owner> clues::item::ExtFileDescOwner::m_owner
protected

Definition at line 209 of file fcntl.hxx.


The documentation for this class was generated from the following files: