36 #ifndef __FD_ARRAY_HH__
37 #define __FD_ARRAY_HH__
60 std::string
const& errout);
83 inline std::shared_ptr<FDEntry>
99 int allocFD(std::shared_ptr<FDEntry> fdp);
112 void setFDEntry(
int tgt_fd, std::shared_ptr<FDEntry> fdep);
128 int openFile(std::string
const& file_name,
int flags, mode_t
mode)
const;
138 std::shared_ptr<FDEntry>
getFDEntry(
int tgt_fd);
152 std::map<std::string, int>
imap;
156 #endif // __FD_ARRAY_HH__
int openOutputFile(std::string const &file_name) const
static void output(const char *filename)
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 getSize() const
Return the size of the _fdArray field.
std::array< std::shared_ptr< FDEntry >, NUM_FDS > _fdArray
Hold pointers to the file descriptor entries.
int openInputFile(std::string const &file_name) const
int closeFDEntry(int tgt_fd)
Try to close the host file descriptor.
void restoreFileOffsets()
Restore all offsets for currently open files during the unserialize phase for the owning process clas...
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...
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.
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...
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...
std::map< std::string, int > oemap
void updateFileOffsets()
Figure out the file offsets for all currently open files and save them the offsets during the calls t...
std::map< std::string, int > imap
Hold strings which represent the default values which are checked against to initialize the standard ...
std::shared_ptr< FDEntry > getFDEntry(int tgt_fd)
Return the file descriptor entry object associated with the index provided.