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

Flags for system calls with at semantics like linkat(), faccessat(). More...

#include <fs.hxx>

+ Inheritance diagram for clues::item::AtFlagsValue:

Public Types

enum class  AtFlag : int {
  EMPTY_PATH = AT_EMPTY_PATH , SYMLINK_NOFOLLOW = AT_SYMLINK_NOFOLLOW , SYMLINK_FOLLOW = AT_SYMLINK_FOLLOW , REMOVEDIR = AT_REMOVEDIR ,
  EACCESS = AT_EACCESS , NO_AUTOMOUNT = AT_NO_AUTOMOUNT
}
 
using AtFlags = cosmos::BitMask<AtFlag>
 
- Public Types inherited from clues::SystemCallItem
enum class  Flag { DEFER_FILL = 1 << 0 }
 
using Flags = cosmos::BitMask<Flag>
 

Public Member Functions

std::string str () const override
 Returns a human readable string representation of the item.
 
AtFlags flags () 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 &) 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

AtFlags 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 for system calls with at semantics like linkat(), faccessat().

Definition at line 103 of file fs.hxx.

Member Typedef Documentation

◆ AtFlags

using clues::item::AtFlagsValue::AtFlags = cosmos::BitMask<AtFlag>

Definition at line 116 of file fs.hxx.

Member Enumeration Documentation

◆ AtFlag

enum class clues::item::AtFlagsValue::AtFlag : int
strong
Enumerator
REMOVEDIR 

only used with unlinkat

EACCESS 

only used with faccessat2

NO_AUTOMOUNT 

only used with fstatat()

Definition at line 107 of file fs.hxx.

107 : int {
108 EMPTY_PATH = AT_EMPTY_PATH,
109 SYMLINK_NOFOLLOW = AT_SYMLINK_NOFOLLOW,
110 SYMLINK_FOLLOW = AT_SYMLINK_FOLLOW,
111 REMOVEDIR = AT_REMOVEDIR,
112 EACCESS = AT_EACCESS,
113 NO_AUTOMOUNT = AT_NO_AUTOMOUNT,
114 };

Constructor & Destructor Documentation

◆ AtFlagsValue()

clues::item::AtFlagsValue::AtFlagsValue ( )
inline

Definition at line 120 of file fs.hxx.

120 :
121 SystemCallItem{ItemType::PARAM_IN, "flags", "*at flags"} {
122 }
SystemCallItem(const ItemType type, const std::string_view short_name={}, const std::string_view long_name={})
Constructs a new SystemCallItem.
@ PARAM_IN
An input parameter to the system call.

Member Function Documentation

◆ flags()

AtFlags clues::item::AtFlagsValue::flags ( ) const
inline

Definition at line 126 of file fs.hxx.

126 {
127 return m_flags;
128 }

◆ processValue()

void clues::item::AtFlagsValue::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 133 of file fs.cxx.

133 {
134 m_flags = AtFlags{valueAs<int>()};
135}
OTHER valueAs() const
Helper to cast the strongly typed Word m_val to other strong enum types.

◆ str()

std::string clues::item::AtFlagsValue::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 113 of file fs.cxx.

113 {
114 BITFLAGS_FORMAT_START(m_flags);
115
116 BITFLAGS_ADD(AT_EMPTY_PATH);
117 BITFLAGS_ADD(AT_SYMLINK_NOFOLLOW);
118 BITFLAGS_ADD(AT_SYMLINK_FOLLOW);
119 /*
120 * some AT_ constants share the same values and are system call
121 * dependent, thus we need to check the context here.
122 */
123 if (m_call->callNr() == SystemCallNr::UNLINKAT)
124 BITFLAGS_ADD(AT_REMOVEDIR);
125 if (m_call->callNr() == SystemCallNr::FACCESSAT2)
126 BITFLAGS_ADD(AT_EACCESS);
127 if (m_call->callNr() == SystemCallNr::FSTATAT64 || m_call->callNr() == SystemCallNr::NEWFSTATAT)
128 BITFLAGS_ADD(AT_NO_AUTOMOUNT);
129
130 return BITFLAGS_STR();
131}
const SystemCall * m_call
The system call context this item part of.

Member Data Documentation

◆ m_flags

AtFlags clues::item::AtFlagsValue::m_flags
protected

Definition at line 136 of file fs.hxx.


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