parser: RETURN [<native call> AS] SET_FUNC
[m6w6/ext-psi] / psi.d / errno.psi
index 4c987d68b113c5bec1ded99acc72ced02ba1b694..f74d0ed4982295fa62930a7c843f653c6ec5a654 100644 (file)
@@ -1,5 +1,14 @@
-// redirected macro
-extern int errno();
+#include <errno.h>
+
+#ifdef __GNUC__
+# ifdef linux
 function psi\errno() : int {
-       return to_int(errno);
+       return __errno_location() as to_int(*__errno_location);
 }
+# endif /* linux */
+# ifdef __FreeBSD__
+function psi\errno() : int {
+       return __error() as to_int(*__error);
+}
+# endif /* __FreeBSD__ */
+#endif /* __GNUC__ */