flush
[m6w6/ext-psi] / psi.d / stat.psi
1 // extern int stat(char *path, struct stat *buf);
2 function psi\stat(string $path, array &$buf = NULL) : int {
3 let path = strval($path);
4 let buf = calloc(1, psi\SIZEOF_STRUCT_STAT);
5 return to_int(stat);
6 set $buf = to_array(*buf,
7 to_int(st_dev),
8 to_int(st_ino),
9 to_int(st_mode),
10 to_int(st_nlink),
11 to_int(st_uid),
12 to_int(st_gid),
13 to_int(st_rdev),
14 to_int(st_size),
15 to_array(st_atim,
16 to_int(tv_sec),
17 to_int(tv_nsec)
18 ),
19 to_array(st_atimespec,
20 to_int(tv_sec),
21 to_int(tv_nsec)
22 ),
23 to_int(st_atime),
24 to_array(st_mtim,
25 to_int(tv_sec),
26 to_int(tv_nsec)
27 ),
28 to_array(st_mtimespec,
29 to_int(tv_sec),
30 to_int(tv_nsec)
31 ),
32 to_int(st_mtime),
33 to_array(st_ctim,
34 to_int(tv_sec),
35 to_int(tv_nsec)
36 ),
37 to_array(st_ctimespec,
38 to_int(tv_sec),
39 to_int(tv_nsec)
40 ),
41 to_int(st_ctime),
42 to_array(st_birthtimespec,
43 to_int(tv_sec),
44 to_int(tv_nsec)
45 ),
46 to_int(st_birthtime),
47 to_int(st_blksize),
48 to_int(st_blocks),
49 to_int(st_flags),
50 to_int(st_gen)
51 );
52 }