ffi: improve support for functions returning arrays
[m6w6/ext-psi] / psi.d / uname.psi
index 6c6a6b0f914ec142dd6acd7f7e7bc66de0fbd2d3..404399cfdf458ccb014d6ea4072d47ac9119dd29 100644 (file)
@@ -1,6 +1,8 @@
+#include <sys/utsname.h>
+
 function psi\uname(array &$u = NULL) : int {
-       let name = calloc(1, psi\SIZEOF_STRUCT_UTSNAME);
-       return to_int(uname);
+       let name = calloc(1, sizeof(struct utsname));
+       return uname(name) as to_int(uname);
        set $u = to_array(*name,
                to_string(sysname),
                to_string(nodename),
@@ -8,4 +10,4 @@ function psi\uname(array &$u = NULL) : int {
                to_string(version), 
                to_string(machine),
                to_string(domainname));
-}
\ No newline at end of file
+}