12345678module snapshot910#flag -I@VMODROOT/vendor/shim11#flag @VMODROOT/vendor/shim/koh_stat.c12#include "koh_stat.h"1314pub struct C.koh_stat {15 size i6416 mtime_ns i6417 ctime_ns i6418 mode u3219 kind int20}2122fn C.koh_lstat(path &char, out &C.koh_stat) int2324pub enum Kind {25 missing26 file27 dir28 symlink29 other30}3132pub struct Stat {33pub:34 size i6435 mtime_ns i6436 ctime_ns i6437 mode u3238 kind Kind39}4041pub fn lstat(path string) ?Stat {42 mut raw := C.koh_stat{}43 if C.koh_lstat(unsafe { &char(path.str) }, &raw) == 0 {44 return none45 }46 return Stat{47 size: raw.size48 mtime_ns: raw.mtime_ns49 ctime_ns: raw.ctime_ns50 mode: raw.mode51 kind: match raw.kind {52 1 { .file }53 2 { .dir }54 3 { .symlink }55 else { .other }56 }57 }58}5960pub fn is_executable(mode u32) bool {61 return mode & 0o111 != 062}