LLDB mainline
lldb_private::FileAction Class Reference

Represents a file descriptor action to be performed during process launch. More...

#include <FileAction.h>

Inheritance diagram for lldb_private::FileAction:
[legend]

Public Types

enum  Action { eFileActionNone , eFileActionClose , eFileActionDuplicate , eFileActionOpen }

Public Member Functions

 FileAction ()
void Clear ()
 Reset this FileAction to its default state.
bool Close (int fd)
 Configure this action to close a file descriptor.
bool Duplicate (int fd, int dup_fd)
 Configure this action to duplicate a file descriptor.
bool Open (int fd, const FileSpec &file_spec, bool read, bool write)
 Configure this action to open a file.
int GetFD () const
 Get the file descriptor this action applies to.
Action GetAction () const
 Get the type of action.
int GetActionArgument () const
 Get the action-specific argument.
const FileSpecGetFileSpec () const
 Get the file specification for open actions.
void Dump (Stream &stream) const

Protected Attributes

Action m_action = eFileActionNone
 The action for this file.
int m_fd = -1
 The file descriptor this action applies to.
int m_arg = -1
 oflag for eFileActionOpen, dup_fd for eFileActionDuplicate.
FileSpec m_file_spec
 File spec to use for opening after fork or posix_spawn.

Detailed Description

Represents a file descriptor action to be performed during process launch.

FileAction encapsulates operations like opening, closing, or duplicating file descriptors that should be applied when spawning a new process.

Definition at line 21 of file FileAction.h.

Member Enumeration Documentation

◆ Action

Enumerator
eFileActionNone 
eFileActionClose 
eFileActionDuplicate 
eFileActionOpen 

Definition at line 23 of file FileAction.h.

Constructor & Destructor Documentation

◆ FileAction()

FileAction::FileAction ( )

Definition at line 19 of file FileAction.cpp.

References m_file_spec.

Referenced by lldb_private::WindowsFileAction::WindowsFileAction().

Member Function Documentation

◆ Clear()

void FileAction::Clear ( )

Reset this FileAction to its default state.

Definition at line 21 of file FileAction.cpp.

References eFileActionNone, m_action, m_arg, m_fd, and m_file_spec.

Referenced by lldb_private::WindowsFileAction::Clear(), Close(), Duplicate(), and Open().

◆ Close()

bool FileAction::Close ( int fd)

Configure this action to close a file descriptor.

Definition at line 49 of file FileAction.cpp.

References Clear(), eFileActionClose, m_action, and m_fd.

Referenced by lldb_private::ProcessLaunchInfo::AppendCloseFileAction().

◆ Dump()

◆ Duplicate()

bool FileAction::Duplicate ( int fd,
int dup_fd )

Configure this action to duplicate a file descriptor.

Parameters
[in]fdThe file descriptor to duplicate.
[in]dup_fdThe target file descriptor number.

Definition at line 58 of file FileAction.cpp.

References Clear(), eFileActionDuplicate, m_action, m_arg, and m_fd.

Referenced by lldb_private::ProcessLaunchInfo::AppendDuplicateFileAction().

◆ GetAction()

Action lldb_private::FileAction::GetAction ( ) const
inline

◆ GetActionArgument()

int lldb_private::FileAction::GetActionArgument ( ) const
inline

Get the action-specific argument.

For eFileActionOpen, returns the open flags (O_RDONLY, etc.). For eFileActionDuplicate, returns the target fd to duplicate to.

Definition at line 68 of file FileAction.h.

References m_arg.

Referenced by AddPosixSpawnFileAction(), lldb_private::ProcessLauncherWindows::GetInheritedHandles(), and HandleFileAction().

◆ GetFD()

int lldb_private::FileAction::GetFD ( ) const
inline

Get the file descriptor this action applies to.

Definition at line 59 of file FileAction.h.

References m_fd.

Referenced by AddPosixSpawnFileAction(), and lldb_private::ProcessLauncherWindows::GetInheritedHandles().

◆ GetFileSpec()

◆ Open()

Member Data Documentation

◆ m_action

Action lldb_private::FileAction::m_action = eFileActionNone
protected

◆ m_arg

int lldb_private::FileAction::m_arg = -1
protected

oflag for eFileActionOpen, dup_fd for eFileActionDuplicate.

Definition at line 81 of file FileAction.h.

Referenced by Clear(), Dump(), Duplicate(), GetActionArgument(), Open(), and lldb_private::WindowsFileAction::Open().

◆ m_fd

int lldb_private::FileAction::m_fd = -1
protected

The file descriptor this action applies to.

Definition at line 79 of file FileAction.h.

Referenced by Clear(), Close(), Dump(), Duplicate(), GetFD(), lldb_private::WindowsFileAction::GetHandle(), and Open().

◆ m_file_spec

FileSpec lldb_private::FileAction::m_file_spec
protected

File spec to use for opening after fork or posix_spawn.

Definition at line 83 of file FileAction.h.

Referenced by Clear(), Dump(), FileAction(), GetFileSpec(), Open(), and lldb_private::WindowsFileAction::Open().


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