From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9464 invoked by alias); 26 Mar 2003 16:32:27 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 9453 invoked from network); 26 Mar 2003 16:32:26 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 26 Mar 2003 16:32:26 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 18yFij-0000jG-00 for ; Wed, 26 Mar 2003 12:33:53 -0600 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 18yDpA-00029y-00 for ; Wed, 26 Mar 2003 11:32:24 -0500 Date: Wed, 26 Mar 2003 16:32:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: PATCH: Fix SIGRTMIN problems with glibc 2.3 [1/2] Message-ID: <20030326163223.GA4481@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.1i X-SW-Source: 2003-03/txt/msg00513.txt.bz2 SIGRTMIN is (theoretically) the lowest _available_ real-time signal. Up to now, GNU libc hasn't reserved any realtime signals for applications not linked to a threads library (like gdb and gdbserver). However, the newest release starts SIGRTMIN at 35 or so instead of 32. We need to use __SIGRTMIN instead in a couple of places. This takes care of signals/signals.c and cleans up some duplicated code while I'm there. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2003-03-26 Daniel Jacobowitz * signals/signals.c (REALTIME_LO, REALTIME_HI): Define if not already defined. Use __SIGRTMIN if available. (target_signal_from_host): Remove SIGRTMIN block. (do_target_signal_to_host): Remove SIGRTMIN block; check that the signal is within the realtime range. Index: signals.c =================================================================== RCS file: /cvs/src/src/gdb/signals/signals.c,v retrieving revision 1.5 diff -u -p -r1.5 signals.c --- signals.c 27 Aug 2002 22:37:14 -0000 1.5 +++ signals.c 26 Mar 2003 16:25:51 -0000 @@ -30,6 +30,20 @@ #include +/* Always use __SIGRTMIN if it's available. SIGRTMIN is the lowest + _available_ realtime signal, not the lowest supported; glibc takes + several for its own use. */ + +#ifndef REALTIME_LO +# if defined(__SIGRTMIN) +# define REALTIME_LO __SIGRTMIN +# define REALTIME_HI __SIGRTMAX +# elif defined(SIGRTMIN) +# define REALTIME_LO __SIGRTMIN +# define REALTIME_HI __SIGRTMAX +# endif +#endif + /* This table must match in order and size the signals in enum target_signal in target.h. */ /* *INDENT-OFF* */ @@ -492,22 +506,6 @@ target_signal_from_host (int hostsig) } #endif -#if defined (SIGRTMIN) - if (hostsig >= SIGRTMIN && hostsig <= SIGRTMAX) - { - /* This block of TARGET_SIGNAL_REALTIME value is in order. */ - if (33 <= hostsig && hostsig <= 63) - return (enum target_signal) - (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33); - else if (hostsig == 32) - return TARGET_SIGNAL_REALTIME_32; - else if (64 <= hostsig && hostsig <= 127) - return (enum target_signal) - (hostsig - 64 + (int) TARGET_SIGNAL_REALTIME_64); - else - error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal"); - } -#endif return TARGET_SIGNAL_UNKNOWN; } @@ -744,40 +742,12 @@ do_target_signal_to_host (enum target_si default: #if defined (REALTIME_LO) - if (oursig >= TARGET_SIGNAL_REALTIME_33 - && oursig <= TARGET_SIGNAL_REALTIME_63) - { - /* This block of signals is continuous, and - TARGET_SIGNAL_REALTIME_33 is 33 by definition. */ - int retsig = - (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33; - if (retsig >= REALTIME_LO && retsig < REALTIME_HI) - return retsig; - } -#if (REALTIME_LO < 33) - else if (oursig == TARGET_SIGNAL_REALTIME_32) - { - /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with - TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */ - return 32; - } -#endif -#if (REALTIME_HI > 64) - if (oursig >= TARGET_SIGNAL_REALTIME_64 - && oursig <= TARGET_SIGNAL_REALTIME_127) + if (oursig < REALTIME_LO || oursig >= REALTIME_HI) { - /* This block of signals is continuous, and - TARGET_SIGNAL_REALTIME_64 is 64 by definition. */ - int retsig = - (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64; - if (retsig >= REALTIME_LO && retsig < REALTIME_HI) - return retsig; + *oursig_ok = 0; + return 0; } - -#endif -#endif -#if defined (SIGRTMIN) if (oursig >= TARGET_SIGNAL_REALTIME_33 && oursig <= TARGET_SIGNAL_REALTIME_63) { @@ -785,8 +755,7 @@ do_target_signal_to_host (enum target_si TARGET_SIGNAL_REALTIME_33 is 33 by definition. */ int retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33; - if (retsig >= SIGRTMIN && retsig <= SIGRTMAX) - return retsig; + return retsig; } else if (oursig == TARGET_SIGNAL_REALTIME_32) { @@ -804,6 +773,7 @@ do_target_signal_to_host (enum target_si return retsig; } #endif + *oursig_ok = 0; return 0; }