| 234 | } |
| 235 | |
| 236 | WasiExpect<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 | |
| 263 | WasiExpect<void> |
| 264 | INode::fdFdstatSetFlags(__wasi_fdflags_t FdFlags) const noexcept { |
nothing calls this directly
no test coverage detected