diff options
author | Guido van Rossum <guido@python.org> | 2000-09-19 13:35:40 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-09-19 13:35:40 (GMT) |
commit | 4622e146ee77148ddddf6ef1ecfcf306b5286262 (patch) | |
tree | 04918a919543dcf56a35d9aab43a1e18b2f4ead5 /Modules/fpectlmodule.c | |
parent | 6df27f8d1cdc723f4442cf44e9235cb8e7f38942 (diff) | |
download | cpython-4622e146ee77148ddddf6ef1ecfcf306b5286262.zip cpython-4622e146ee77148ddddf6ef1ecfcf306b5286262.tar.gz cpython-4622e146ee77148ddddf6ef1ecfcf306b5286262.tar.bz2 |
Randall Hopper: Add fpectl functionality patch for FreeBSD.
Diffstat (limited to 'Modules/fpectlmodule.c')
-rw-r--r-- | Modules/fpectlmodule.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Modules/fpectlmodule.c b/Modules/fpectlmodule.c index 039deb4..59d2b72 100644 --- a/Modules/fpectlmodule.c +++ b/Modules/fpectlmodule.c @@ -68,6 +68,10 @@ extern "C" { #include "Python.h" #include <signal.h> +#if defined(__FreeBSD__) +# include <ieeefp.h> +#endif + #ifndef WANT_SIGFPE_HANDLER /* Define locally if they are not defined in Python. This gives only * the limited control to induce a core dump in case of an exception. @@ -178,6 +182,12 @@ static void fpe_reset(Sigfunc *handler) #endif signal(SIGFPE, handler); +/*-- FreeBSD ----------------------------------------------------------------*/ +#elif defined(__FreeBSD__) + fpresetsticky( fpgetsticky() ); + fpsetmask( FP_X_INV | FP_X_DZ | FP_X_OFL ); + signal( SIGFPE, handler ); + /*-- Linux ----------------------------------------------------------------*/ #elif defined(linux) #ifdef __GLIBC__ @@ -212,7 +222,12 @@ static void fpe_reset(Sigfunc *handler) static PyObject *turnoff_sigfpe(PyObject *self,PyObject *args) { +#ifdef __FreeBSD__ + fpresetsticky( fpgetsticky() ); + fpsetmask( 0 ); +#else fputs("Operation not implemented\n", stderr); +#endif Py_INCREF (Py_None); return Py_None; } |