X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=psi.d%2Ferrno.psi;h=8953ca7427b6a960f262acb5cc93e0d5b49cd047;hp=4c987d68b113c5bec1ded99acc72ced02ba1b694;hb=c57af11984f284e7e9de5bde5c189c416004638c;hpb=974c9580535a1668dd6eed9992d582ebcc29b27a diff --git a/psi.d/errno.psi b/psi.d/errno.psi index 4c987d6..8953ca7 100644 --- a/psi.d/errno.psi +++ b/psi.d/errno.psi @@ -1,5 +1,14 @@ -// redirected macro -extern int errno(); +#include + +#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__ */