36 #ifndef __FD_ENTRY_HH__ 37 #define __FD_ENTRY_HH__ 58 virtual std::shared_ptr<FDEntry>
clone()
const = 0;
79 HBFDEntry(
int flags,
int sim_fd,
bool close_on_exec =
false)
80 :
FDEntry(close_on_exec), _flags(flags), _simFD(sim_fd)
84 :
FDEntry(close_on_exec), _flags(reg._flags), _simFD(reg._simFD)
87 std::shared_ptr<FDEntry>
90 return std::make_shared<HBFDEntry>(*this);
116 uint64_t file_offset,
bool close_on_exec =
false)
117 :
HBFDEntry(flags, sim_fd, close_on_exec),
118 _fileName(file_name), _fileOffset(file_offset)
122 :
HBFDEntry(reg._flags, reg._simFD, close_on_exec),
123 _fileName(reg._fileName), _fileOffset(reg._fileOffset)
126 std::shared_ptr<FDEntry>
129 return std::make_shared<FileFDEntry>(*this);
135 void setFileName(std::string
const& file_name) { _fileName = file_name; }
159 bool close_on_exec =
false)
160 :
HBFDEntry(flags, sim_fd, close_on_exec), _pipeReadSource(-1),
161 _pipeEndType(pipe_end_type)
165 :
HBFDEntry(pipe._flags, pipe._simFD, close_on_exec),
166 _pipeReadSource(pipe._pipeReadSource),
167 _pipeEndType(pipe._pipeEndType)
170 std::shared_ptr<FDEntry>
173 return std::make_shared<PipeFDEntry>(*this);
198 bool close_on_exec =
false)
199 :
FDEntry(close_on_exec), _driver(driver), _fileName(file_name)
203 :
FDEntry(close_on_exec), _driver(dev._driver),
204 _fileName(dev._fileName)
207 std::shared_ptr<FDEntry>
210 return std::make_shared<DeviceFDEntry>(*this);
228 bool close_on_exec =
false)
230 _domain(domain), _type(type), _protocol(protocol)
234 :
HBFDEntry(reg._flags, reg._simFD, close_on_exec),
235 _domain(reg._domain), _type(reg._type), _protocol(reg._protocol)
238 std::shared_ptr<FDEntry>
241 return std::make_shared<SocketFDEntry>(*this);
249 #endif // __FD_ENTRY_HH__ std::shared_ptr< FDEntry > clone() const override
PipeFDEntry(int sim_fd, int flags, EndType pipe_end_type, bool close_on_exec=false)
EndType getEndType() const
void setCOE(bool close_on_exec)
virtual std::shared_ptr< FDEntry > clone() const =0
SocketFDEntry(int sim_fd, int domain, int type, int protocol, bool close_on_exec=false)
Holds a single file descriptor mapping and that mapping's data for processes running in syscall emula...
DeviceFDEntry(DeviceFDEntry const &dev, bool close_on_exec=false)
std::shared_ptr< FDEntry > clone() const override
void setFileName(std::string const &file_name)
virtual void serialize(CheckpointOut &cp) const
Serialize an object.
Holds file descriptors for host-backed files; host-backed files are files which were opened on the ph...
void setSimFD(int sim_fd)
PipeFDEntry(PipeFDEntry const &pipe, bool close_on_exec=false)
void setPipeReadSource(int tgt_fd)
std::string const & getFileName() const
SocketFDEntry(SocketFDEntry const ®, bool close_on_exec=false)
HBFDEntry(int flags, int sim_fd, bool close_on_exec=false)
uint64_t getFileOffset() const
Extends the base class to include a host-backed file descriptor field that records the integer used t...
std::string const & getFileName() const
DeviceFDEntry(EmulatedDriver *driver, std::string const &file_name, bool close_on_exec=false)
void setEndType(EndType type)
Basic support for object serialization.
FileFDEntry(FileFDEntry const ®, bool close_on_exec=false)
void setFileOffset(uint64_t f_off)
Holds the metadata needed to maintain the mappings for file descriptors allocated with the pipe() sys...
virtual void unserialize(CheckpointIn &cp)
Unserialize an object.
std::ostream CheckpointOut
std::shared_ptr< FDEntry > clone() const override
std::shared_ptr< FDEntry > clone() const override
EmulatedDriver * getDriver() const
EmulatedDriver is an abstract base class for fake SE-mode device drivers.
Holds file descriptors needed to simulate devices opened with pseudo files (commonly with calls to io...
FileFDEntry(int sim_fd, int flags, std::string const &file_name, uint64_t file_offset, bool close_on_exec=false)
std::shared_ptr< FDEntry > clone() const override
HBFDEntry(HBFDEntry const ®, bool close_on_exec=false)
int getPipeReadSource() const
FDEntry(bool close_on_exec=false)