MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / fdFdstatGet

Method fdFdstatGet

lib/host/wasi/inode-linux.cpp:236–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234}
235
236WasiExpect<void> INode::fdFdstatGet(__wasi_fdstat_t &FdStat) const noexcept {
237 EXPECTED_TRY(updateStat());
238
239 if (int FdFlags = ::fcntl(Fd, F_GETFL); unlikely(FdFlags < 0)) {
240 return WasiUnexpect(fromErrNo(errno));
241 } else {
242 FdStat.fs_filetype = EndianValue(unsafeFiletype()).le();
243
244 FdStat.fs_flags = static_cast<__wasi_fdflags_t>(0);
245 if (FdFlags & O_APPEND) {
246 FdStat.fs_flags |= __WASI_FDFLAGS_APPEND;
247 }
248 if (FdFlags & O_DSYNC) {
249 FdStat.fs_flags |= __WASI_FDFLAGS_DSYNC;
250 }
251 if (FdFlags & O_NONBLOCK) {
252 FdStat.fs_flags |= __WASI_FDFLAGS_NONBLOCK;
253 }
254 if (FdFlags & O_SYNC) {
255 FdStat.fs_flags |= __WASI_FDFLAGS_RSYNC | __WASI_FDFLAGS_SYNC;
256 }
257 }
258 FdStat.fs_flags = EndianValue(FdStat.fs_flags).le();
259
260 return {};
261}
262
263WasiExpect<void>
264INode::fdFdstatSetFlags(__wasi_fdflags_t FdFlags) const noexcept {

Callers

nothing calls this directly

Calls 6

unlikelyFunction · 0.85
WasiUnexpectFunction · 0.85
EndianValueClass · 0.85
leMethod · 0.80
fromErrNoFunction · 0.70
EXPECTED_TRYFunction · 0.50

Tested by

no test coverage detected