stat(path_ptr, path_len, stat_buf) -> i32
| 160 | |
| 161 | // stat(path_ptr, path_len, stat_buf) -> i32 |
| 162 | static std::vector<Value> fs_stat(Stack& stack) { |
| 163 | Frame& frame = stack.frames.top(); |
| 164 | i64_t path_ptr = get_ptr(frame.locals[0]); |
| 165 | i64_t path_len = get_ptr(frame.locals[1]); |
| 166 | i64_t stat_buf = get_ptr(frame.locals[2]); |
| 167 | try { |
| 168 | std::string path = mem_string(stack, path_ptr, path_len); |
| 169 | stat_t st; |
| 170 | if(sys_stat(path.c_str(), &st) != 0) return {Value(err_code())}; |
| 171 | write_wasm_stat(stack, stat_buf, st); |
| 172 | return {Value(i32_t(0))}; |
| 173 | } catch(...) { |
| 174 | return {Value(i32_t(-EFAULT))}; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | // fstat(fd:i32, stat_buf) -> i32 |
| 179 | static std::vector<Value> fs_fstat(Stack& stack) { |
nothing calls this directly
no test coverage detected