Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/softfloat Use sigqueueinfo() instead of raise() to ...



details:   https://anonhg.NetBSD.org/src/rev/a4aeb9f19329
branches:  trunk
changeset: 762881:a4aeb9f19329
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Mar 04 11:48:58 2011 +0000

description:
Use sigqueueinfo() instead of raise() to generate exceptions. Provide
minimalistic siginfo data.

diffstat:

 lib/libc/softfloat/softfloat-specialize |  21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diffs (46 lines):

diff -r 1f7b8c84001d -r a4aeb9f19329 lib/libc/softfloat/softfloat-specialize
--- a/lib/libc/softfloat/softfloat-specialize   Fri Mar 04 09:47:47 2011 +0000
+++ b/lib/libc/softfloat/softfloat-specialize   Fri Mar 04 11:48:58 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: softfloat-specialize,v 1.4 2004/09/26 21:13:27 jmmv Exp $      */
+/*     $NetBSD: softfloat-specialize,v 1.5 2011/03/04 11:48:58 martin Exp $    */
 
 /* This is a derivative work. */
 
@@ -33,6 +33,8 @@
 */
 
 #include <signal.h>
+#include <string.h>
+#include <unistd.h>
 
 /*
 -------------------------------------------------------------------------------
@@ -56,11 +58,26 @@
 fp_except float_exception_mask = 0;
 void float_raise( fp_except flags )
 {
+    siginfo_t info;
 
     float_exception_flags |= flags;
 
     if ( flags & float_exception_mask ) {
-       raise( SIGFPE );
+       memset(&info, 0, sizeof info);
+       info.si_signo = SIGFPE;
+       info.si_pid = getpid();
+       info.si_uid = geteuid();
+       if (flags & float_flag_underflow)
+           info.si_code = FPE_FLTUND;
+       else if (flags & float_flag_overflow)
+           info.si_code = FPE_FLTOVF;
+       else if (flags & float_flag_divbyzero)
+           info.si_code = FPE_FLTDIV;
+       else if (flags & float_flag_invalid)
+           info.si_code = FPE_FLTINV;
+       else if (flags & float_flag_inexact)
+           info.si_code = FPE_FLTRES;
+       sigqueueinfo(getpid(), &info);
     }
 }
 



Home | Main Index | Thread Index | Old Index