Class storage::FileDescriptor

class storage::FileDescriptor

Public Functions

FileDescriptor() = default
DirEnt iterNext()
bool iterStarted() const
bool iterFinished()
void iterBack()
void iterReset()
size_t copyDirentsToWasiBuffer(uint8_t *buffer, size_t bufferLen)

Note that this function conforms to the standard readdir interface:

  • Copy each dirent struct followed by its path string

  • If the last path string doesn’t fit, return the buffer length

  • If the last dirent doesn’t fit, don’t copy it and return the buffer length

The external libc wrapper should prevent this third point.

If the final dirent or path doesn’t fit, the caller will expect the next result to contain that same dirent/ path, so we have to step back one in the iterator if that’s the case.

The caller knows they’ve reached the end when the buffer is not filled by this call.

Stat stat(const std::string &relativePath = "")
bool unlink(const std::string &relativePath = "")
bool rmdir(const std::string &relativePath = "")
bool rename(const std::string &newPath, const std::string &relativePath = "")
ssize_t readLink(const std::string &relativePath, char *buffer, size_t bufferLen)
bool pathOpen(uint32_t lookupFlags, uint32_t openFlags, int32_t fdFlags)
bool updateFlags(int32_t fdFlags)
ssize_t write(std::vector<::iovec> &nativeIovecs, int iovecCount)
void close() const
bool mkdir(const std::string &dirPath)
uint16_t seek(int64_t offset, int wasiWhence, uint64_t *newOffset) const
uint64_t tell() const
int getLinuxFd() const
int getLinuxFlags() const
int getLinuxErrno() const
uint16_t getWasiErrno() const
uint64_t getActualRightsBase() const
uint64_t getActualRightsInheriting() const
void setActualRights(uint64_t rights, uint64_t inheriting)
std::string absPath(const std::string &relativePath)
void setPath(const std::string &newPath)
std::string getPath()
int duplicate(const FileDescriptor &other)

Public Members

uint8_t wasiPreopenType

Public Static Functions

static FileDescriptor stdinFactory()
static FileDescriptor stdoutFactory()
static FileDescriptor stderrFactory()