parser: RETURN [<native call> AS] SET_FUNC
[m6w6/ext-psi] / psi.d / stat.psi
index e5d8eba135b6e22a4052ca4e90c550332db44f84..9b767dacc0d19a1fc4ec44d1e03747877fca9dc8 100644 (file)
@@ -1,8 +1,8 @@
-extern int stat(char *path, struct stat *buf);
+// 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, psi\SIZEOF_STRUCT_STAT);
+       return stat(path, buf) as to_int(stat);
        set $buf = to_array(*buf,
                to_int(st_dev),
                to_int(st_ino),
@@ -15,7 +15,7 @@ function psi\stat(string $path, array &$buf = NULL) : int {
                to_array(st_atim,
                        to_int(tv_sec),
                        to_int(tv_nsec)
-               ), 
+               ),
                to_array(st_atimespec,
                        to_int(tv_sec),
                        to_int(tv_nsec)
@@ -23,7 +23,7 @@ function psi\stat(string $path, array &$buf = NULL) : int {
                to_array(st_mtim,
                        to_int(tv_sec),
                        to_int(tv_nsec)
-               ), 
+               ),
                to_array(st_mtimespec,
                        to_int(tv_sec),
                        to_int(tv_nsec)
@@ -31,11 +31,15 @@ function psi\stat(string $path, array &$buf = NULL) : int {
                to_array(st_ctim,
                        to_int(tv_sec),
                        to_int(tv_nsec)
-               ), 
+               ),
                to_array(st_ctimespec,
                        to_int(tv_sec),
                        to_int(tv_nsec)
                ),
+               to_array(st_birthtim,
+                       to_int(tv_sec),
+                       to_int(tv_nsec)
+               ),
                to_array(st_birthtimespec,
                        to_int(tv_sec),
                        to_int(tv_nsec)