9b767dacc0d19a1fc4ec44d1e03747877fca9dc8
[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 stat(path, buf) as 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_array(st_mtim,
24 to_int(tv_sec),
25 to_int(tv_nsec)
26 ),
27 to_array(st_mtimespec,
28 to_int(tv_sec),
29 to_int(tv_nsec)
30 ),
31 to_array(st_ctim,
32 to_int(tv_sec),
33 to_int(tv_nsec)
34 ),
35 to_array(st_ctimespec,
36 to_int(tv_sec),
37 to_int(tv_nsec)
38 ),
39 to_array(st_birthtim,
40 to_int(tv_sec),
41 to_int(tv_nsec)
42 ),
43 to_array(st_birthtimespec,
44 to_int(tv_sec),
45 to_int(tv_nsec)
46 ),
47 to_int(st_blksize),
48 to_int(st_blocks),
49 to_int(st_flags),
50 to_int(st_gen)
51 );
52 }