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

Flags used in Pipe2SystemCall. More...

#include <io.hxx>

+ Inheritance diagram for clues::item::PipeFlags:

Public Types

enum class  Flag : int { CLOEXEC = O_CLOEXEC , DIRECT = O_DIRECT , NONBLOCK = O_NONBLOCK , NOTIFICATION_PIPE = O_EXCL }
 
using Flags = cosmos::BitMask<Flag>
 
- Public Types inherited from clues::SystemCallItem
enum class  Flag { DEFER_FILL = 1 << 0 }
 
using Flags = cosmos::BitMask<Flag>
 

Public Member Functions

Flags flags () const
 
std::string str () const override
 Returns a human readable string representation of the item.
 
- Public Member Functions inherited from clues::item::ValueInParameter
 ValueInParameter (const std::string_view short_name, const std::string_view long_name={})
 
- Public Member Functions inherited from clues::item::ValueParameter
 ValueParameter (const ItemType type, const std::string_view short_name, const std::string_view long_name={})
 
- 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

Flags m_flags
 
- 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.
 

Detailed Description

Flags used in Pipe2SystemCall.

Definition at line 68 of file io.hxx.

Member Typedef Documentation

◆ Flags

using clues::item::PipeFlags::Flags = cosmos::BitMask<Flag>

Definition at line 81 of file io.hxx.

Member Enumeration Documentation

◆ Flag

enum class clues::item::PipeFlags::Flag : int
strong

Definition at line 72 of file io.hxx.

72 : int {
73 CLOEXEC = O_CLOEXEC,
74 DIRECT = O_DIRECT,
75 NONBLOCK = O_NONBLOCK,
76 NOTIFICATION_PIPE = O_EXCL /* this constant seems only defined in kernel headers and is just a reused O_EXCL */
77 };

Constructor & Destructor Documentation

◆ PipeFlags()

clues::item::PipeFlags::PipeFlags ( )
inlineexplicit

Definition at line 85 of file io.hxx.

85 :
86 ValueInParameter{"flags"} {
87 }

Member Function Documentation

◆ flags()

Flags clues::item::PipeFlags::flags ( ) const
inline

Definition at line 89 of file io.hxx.

89 {
90 return m_flags;
91 }

◆ processValue()

void clues::item::PipeFlags::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 60 of file io.cxx.

60 {
61 m_flags = Flags{valueAs<int>()};
62}
OTHER valueAs() const
Helper to cast the strongly typed Word m_val to other strong enum types.

◆ str()

std::string clues::item::PipeFlags::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 37 of file io.cxx.

37 {
38 BITFLAGS_FORMAT_START(m_flags);
39
40#define O_NOTIFICATION_PIPE O_EXCL
41
42 BITFLAGS_ADD(O_CLOEXEC);
43 BITFLAGS_ADD(O_DIRECT);
44 BITFLAGS_ADD(O_NONBLOCK);
45 /*
46 * This notification pipe mechanism is a pretty weird communication
47 * mechanism towards the kernel which can be used to e.g. get
48 * information out keyring events. A bit of a misused pipe for
49 * netlink-like purposes.
50 *
51 * From the tracing POV all we could do is interpreting the messages
52 * exchanged on such a pipe, but it doesn't seem worth the effort,
53 * I've never seen it in production.
54 */
55 BITFLAGS_ADD(O_NOTIFICATION_PIPE);
56
57 return BITFLAGS_STR();
58}

Member Data Documentation

◆ m_flags

Flags clues::item::PipeFlags::m_flags
protected

Definition at line 101 of file io.hxx.


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