libclues
Linux C++ Tracing Library
Loading...
Searching...
No Matches
clues::PipeSystemCall Struct Reference

The classic pipe() system call without flags. More...

#include <io.hxx>

+ Inheritance diagram for clues::PipeSystemCall:

Public Member Functions

 PipeSystemCall (const SystemCallNr nr=SystemCallNr::PIPE)
 
- Public Member Functions inherited from clues::SystemCall
 SystemCall (const SystemCallNr nr)
 Instantiates a new SystemCall object with given properties.
 
 SystemCall (const SystemCall &other)=delete
 
SystemCalloperator= (const SystemCall &other)=delete
 
void setEntryInfo (const Tracee &proc, const SystemCallInfo &info)
 Update the stored parameter values from the given tracee.
 
void setExitInfo (const Tracee &proc, const SystemCallInfo &info)
 Update possible out and return parameter values from the given tracee.
 
std::string_view name () const
 Returns the system call's human readable name.
 
size_t numPars () const
 Returns the number of parameters for this system call.
 
SystemCallNr callNr () const
 Returns the system call table number for this system call.
 
const ParameterVectorparameters () const
 Access to the parameters associated with this system call.
 
SystemCallItemPtr result () const
 Access to the return value parameter associated with this system call.
 
std::optional< ErrnoResulterror () const
 Access to the errno result seen for this system call.
 
bool hasOutParameter () const
 
bool hasResultValue () const
 
bool hasErrorCode () const
 
ABI abi () const
 Returns the system call ABi seen during system call entry.
 
bool is32BitEmulationABI () const
 
const SystemCallInfocurrentInfo () const
 Access the current SystemCallInfo if currently processing syscall entry/exit.
 

Public Attributes

item::PipeEnds ends
 
item::SuccessResult result
 

Protected Member Functions

void updateFDTracking (const Tracee &proc) override
 Update file descriptor tracking.
 
- Protected Member Functions inherited from clues::SystemCall
void fillParameters (const Tracee &proc, const SystemCallInfo &info)
 
void setReturnItem (SystemCallItem &ret)
 Sets the return value system call item.
 
void addParameters ()
 
template<typename T, typename... Targs>
void addParameters (T &par, Targs &...rest)
 
template<typename... Targs>
void setParameters (Targs &...args)
 
virtual bool check2ndPass (const Tracee &)
 Check whether a second pass needs to be made processing parameters.
 
virtual void prepareNewSystemCall ()
 Perform any necessary actions before processing a new system call entry event.
 
void dropFD (const Tracee &proc, const cosmos::FileNum num)
 
void trackFD (const Tracee &proc, FDInfo &&info)
 

Additional Inherited Members

- Public Types inherited from clues::SystemCall
using ParameterVector = std::vector<SystemCallItemPtr>
 Vector of the parameters required for a system call.
 
- Static Public Member Functions inherited from clues::SystemCall
static const char * name (const SystemCallNr nr)
 Returns the name of the given system call or "<unknown>" if unknown.
 
static bool validNr (const SystemCallNr nr)
 Returns whether the given system call number is in a valid range.
 
- Protected Attributes inherited from clues::SystemCall
SystemCallNr m_nr
 The raw system call number of the system call.
 
const std::string_view m_name
 The basic name of the system call.
 
const SystemCallInfom_info = nullptr
 Current system call info during entry/exit processing, nullptr otherwise.
 
SystemCallItemPtr m_return
 The return value of the system call.
 
std::optional< ErrnoResultm_error
 If the system call fails, this is the error code.
 
ParameterVector m_pars
 The array of system call parameters, if any.
 
ABI m_abi = ABI::UNKNOWN
 The current system call ABI which is in effect.
 

Detailed Description

The classic pipe() system call without flags.

Definition at line 82 of file io.hxx.

Constructor & Destructor Documentation

◆ PipeSystemCall()

clues::PipeSystemCall::PipeSystemCall ( const SystemCallNr nr = SystemCallNr::PIPE)
inlineexplicit

Definition at line 85 of file io.hxx.

85 :
86 SystemCall{nr} {
87 setReturnItem(result);
88 setParameters(ends);
89 /*
90 * XXX: some architectures like IA64, Alpha, MIPS, Sparc,
91 * SuperH return the two file descriptors as return values in
92 * two registers. This still needs to be covered once one of
93 * the respective ABIs is supported.
94 */
95 }
void setReturnItem(SystemCallItem &ret)
Sets the return value system call item.
SystemCall(const SystemCallNr nr)
Instantiates a new SystemCall object with given properties.

Member Function Documentation

◆ updateFDTracking()

void clues::PipeSystemCall::updateFDTracking ( const Tracee & proc)
overrideprotectedvirtual

Update file descriptor tracking.

This function is called upon successful system call exit to track any potential new file descriptors or stop tracking of existing file descriptors.

Specializations of SystemCall that create or close file descriptors need to overwrite this function and call proc.trackFD() or proc.dropFD() accordingly.

Reimplemented from clues::SystemCall.

Definition at line 6 of file io.cxx.

6 {
7 if (ends.haveEnds()) {
8 FDInfo read_info{FDInfo::Type::PIPE, ends.readEnd()};
9 FDInfo write_info{FDInfo::Type::PIPE, ends.writeEnd()};
10
11 // model the read and write ends via appropriate OpenMode values
12 read_info.mode = cosmos::OpenMode::READ_ONLY;
13 write_info.mode = cosmos::OpenMode::WRITE_ONLY;
14
15 trackFD(proc, std::move(read_info));
16 trackFD(proc, std::move(write_info));
17 }
18}
@ PIPE
created by pipe()
Definition types.hxx:94

Member Data Documentation

◆ ends

item::PipeEnds clues::PipeSystemCall::ends

Definition at line 97 of file io.hxx.

◆ result

item::SuccessResult clues::PipeSystemCall::result

Definition at line 98 of file io.hxx.


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