32#ifndef __FD_ARRAY_HH__
33#define __FD_ARRAY_HH__
60 std::string
const& errout);
80 void setFDEntry(
int tgt_fd, std::shared_ptr<FDEntry> fdep);
87 std::shared_ptr<FDEntry>
108 int allocFD(std::shared_ptr<FDEntry> fdp);
144 std::shared_ptr<FDEntry>
getFDEntry(
int tgt_fd);
int closeFDEntry(int tgt_fd)
Try to close the host file descriptor.
void updateFileOffsets()
Figure out the file offsets for all currently open files and save them the offsets during the calls t...
std::string _input
Hold param strings passed from the Process class which indicate the filename for each of the correspo...
std::map< std::string, int > _oemap
std::map< std::string, int > _imap
Hold strings which represent the default values which are checked against to initialize the standard ...
int openInputFile(std::string const &file_name) const
void unserialize(CheckpointIn &cp) override
Unserialize an object.
std::shared_ptr< FDEntry > operator[](int tgt_fd)
Treat this object like a normal array in using the subscript operator to pull entries out of it.
FDArray(std::string const &input, std::string const &output, std::string const &errout)
Initialize the file descriptor array and set the standard file descriptors to defaults or values pass...
int openFile(std::string const &file_name, int flags, mode_t mode) const
Help clarify our intention when opening files in the init and restoration code.
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::array< std::shared_ptr< FDEntry >, _numFDs > _fdArray
int allocFD(std::shared_ptr< FDEntry > fdp)
Step through the file descriptor array and find the first available entry which is denoted as being f...
void setFDEntry(int tgt_fd, std::shared_ptr< FDEntry > fdep)
Put the pointer specified by fdep into the _fdArray entry indexed by tgt_fd.
int openOutputFile(std::string const &file_name) const
std::shared_ptr< FDEntry > getFDEntry(int tgt_fd)
Return the file descriptor entry object associated with the index provided.
void unserialize(CheckpointIn &cp, Process *process_ptr)
static constexpr size_t _numFDs
Hold pointers to the file descriptor entries.
int getSize() const
Return the size of the _fdArray field.
void restoreFileOffsets()
Restore all offsets for currently open files during the unserialize phase for the owning process clas...
Basic support for object serialization.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::ostream CheckpointOut
static void output(const char *filename)