-extern int stat(char *path, struct stat *buf);
+#include <sys/stat.h>
+// extern int stat(char *path, struct stat *buf);
function psi\stat(string $path, array &$buf = NULL) : int {
let path = strval($path);
- let buf = calloc(1, struct stat);
- return to_int(stat);
+ let buf = calloc(1, sizeof(struct stat));
+ return stat(path, buf) as to_int(stat);
set $buf = to_array(*buf,
to_int(st_dev),
to_int(st_ino),
to_int(tv_sec),
to_int(tv_nsec)
),
- to_int(st_atime),
to_array(st_mtim,
to_int(tv_sec),
to_int(tv_nsec)
to_int(tv_sec),
to_int(tv_nsec)
),
- to_int(st_mtime),
to_array(st_ctim,
to_int(tv_sec),
to_int(tv_nsec)
to_int(tv_sec),
to_int(tv_nsec)
),
- to_int(st_ctime),
+ to_array(st_birthtim,
+ to_int(tv_sec),
+ to_int(tv_nsec)
+ ),
to_array(st_birthtimespec,
to_int(tv_sec),
to_int(tv_nsec)
),
- to_int(st_birthtime),
to_int(st_blksize),
to_int(st_blocks),
to_int(st_flags),