From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Kettenis To: gdb-patches@sources.redhat.com Subject: [PATCH] Cleanup sigprocmask/sigsetmak usage Date: Thu, 23 Aug 2001 14:45:00 -0000 Message-id: <200108232144.f7NLixL06761@delius.kettenis.local> X-SW-Source: 2001-08/msg00270.html The attached patch cleans up sigprocmask/sigsetmask usage in event-top.c and top.c. Get rid of a few defines in the xm.h files. If nobody shoots any holes in this patch, I'll check this in in a week or two. Mark Index: ChangeLog from Mark Kettenis * event-top.c (async_stop_sig) [HAVE_SIGPROCMASK]: Some gratuitious whitespace changes. [!HAVE_SIGPROCMASK]: Call sigsetmask if HAVE_SIGSETMASK is defined. * top.c: Remove redundant logic to define HAVE_SIGSETMASK. (sigsetmask) Don't define macro. (stop_sig) [HAVE_SIGPROCMASK]: Add bit of code snatched from async_stop_sig from event-top.c. [!HAVE_SIGPROCMASK]: Call sigsetmask if HAVE_SIGSETMASK is defined. * configure.in (AC_CHECK_FUNCS): Put functions in alphabetical order. Add sigsetmask. (AC_FUNC_VFORK, AC_FUNC_ALLOCA): Reorder such that they're in alphabetical order. * config/xm-aix4.h, config/alpha/xm-alphalinux.h, config/i386/xm-cygwin.h, config/rs6000/xm-rs6000.h (HAVE_SIGSETMASK): Remove. * aclocal.m4, config.in, configure Index: event-top.c =================================================================== RCS file: /cvs/src/src/gdb/event-top.c,v retrieving revision 1.15 diff -u -p -r1.15 event-top.c --- event-top.c 2001/07/14 18:59:07 1.15 +++ event-top.c 2001/08/23 21:17:48 @@ -1039,14 +1039,17 @@ async_stop_sig (gdb_client_data arg) char *prompt = get_prompt (); #if STOP_SIGNAL == SIGTSTP signal (SIGTSTP, SIG_DFL); -#if HAVE_SIGPROCMASK +#ifdef HAVE_SIGPROCMASK { sigset_t zero; + sigemptyset (&zero); sigprocmask (SIG_SETMASK, &zero, 0); } #else +#ifdef HAVE_SIGSETMASK sigsetmask (0); +#endif #endif kill (getpid (), SIGTSTP); signal (SIGTSTP, handle_stop_sig); Index: top.c =================================================================== RCS file: /cvs/src/src/gdb/top.c,v retrieving revision 1.43 diff -u -p -r1.43 top.c --- top.c 2001/08/14 20:05:48 1.43 +++ top.c 2001/08/23 21:17:49 @@ -178,19 +178,6 @@ static void stop_sig (int); #endif #endif -/* Some System V have job control but not sigsetmask(). */ -#if !defined (HAVE_SIGSETMASK) -#if !defined (USG) -#define HAVE_SIGSETMASK 1 -#else -#define HAVE_SIGSETMASK 0 -#endif -#endif - -#if 0 == (HAVE_SIGSETMASK) -#define sigsetmask(n) -#endif - /* Hooks for alternate command interfaces. */ /* Called after most modules have been initialized, but before taking users @@ -922,7 +909,18 @@ stop_sig (int signo) { #if STOP_SIGNAL == SIGTSTP signal (SIGTSTP, SIG_DFL); +#ifdef HAVE_SIGPROCMASK + { + sigset_t zero; + + sigemptyset (&zero); + sigprocmask (SIG_SETMASK, &zero, 0); + } +#else +#ifdef HAVE_SIGSETMASK sigsetmask (0); +#endif +#endif kill (getpid (), SIGTSTP); signal (SIGTSTP, stop_sig); #else Index: configure.in =================================================================== RCS file: /cvs/src/src/gdb/configure.in,v retrieving revision 1.70 diff -u -p -r1.70 configure.in --- configure.in 2001/08/16 22:47:00 1.70 +++ configure.in 2001/08/23 21:17:50 @@ -131,9 +131,10 @@ AC_HEADER_STAT AC_C_CONST -AC_CHECK_FUNCS(setpgid setpgrp sbrk sigaction isascii bzero bcopy btowc poll sigprocmask) -AC_FUNC_VFORK +AC_CHECK_FUNCS(bcopy btowc bzero isascii poll sbrk setpgid setpgrp \ + sigaction sigprocmask sigsetmask) AC_FUNC_ALLOCA +AC_FUNC_VFORK dnl AC_FUNC_SETPGRP does not work when cross compiling dnl Instead, assume we will have a prototype for setpgrp if cross compiling. if test "$cross_compiling" = no; then Index: config/xm-aix4.h =================================================================== RCS file: /cvs/src/src/gdb/config/xm-aix4.h,v retrieving revision 1.3 diff -u -p -r1.3 xm-aix4.h --- config/xm-aix4.h 2001/03/06 08:21:20 1.3 +++ config/xm-aix4.h 2001/08/23 21:17:50 @@ -1,5 +1,6 @@ /* Parameters for hosting on an PowerPC, for GDB, the GNU debugger. - Copyright 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1995, 1996, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. Contributed by Cygnus Corporation. This file is part of GDB. @@ -43,7 +44,6 @@ /* #define HAVE_TERMIO 1 */ #define USG 1 -#define HAVE_SIGSETMASK 1 #define FIVE_ARG_PTRACE Index: config/alpha/xm-alphalinux.h =================================================================== RCS file: /cvs/src/src/gdb/config/alpha/xm-alphalinux.h,v retrieving revision 1.2 diff -u -p -r1.2 xm-alphalinux.h --- config/alpha/xm-alphalinux.h 2001/03/06 08:21:21 1.2 +++ config/alpha/xm-alphalinux.h 2001/08/23 21:17:50 @@ -1,5 +1,5 @@ /* Host definitions for GDB running on an Alpha under Linux - Copyright 1996 Free Software Foundation, Inc. + Copyright 1996, 2001 Free Software Foundation, Inc. This file is part of GDB. @@ -26,5 +26,4 @@ #define NO_SIGINTERRUPT #define HAVE_TERMIOS -#define HAVE_SIGSETMASK 1 #define USG Index: config/i386/xm-cygwin.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/xm-cygwin.h,v retrieving revision 1.3 diff -u -p -r1.3 xm-cygwin.h --- config/i386/xm-cygwin.h 2001/06/13 09:08:03 1.3 +++ config/i386/xm-cygwin.h 2001/08/23 21:17:50 @@ -27,8 +27,6 @@ /* Define this if source files use \r\n rather than just \n. */ #define CRLF_SOURCE_FILES -#define HAVE_SIGSETMASK 0 - /* If under Cygwin, provide backwards compatibility with older Cygwin compilers that don't define the current cpp define. */ #ifdef __CYGWIN32__ Index: config/rs6000/xm-rs6000.h =================================================================== RCS file: /cvs/src/src/gdb/config/rs6000/xm-rs6000.h,v retrieving revision 1.5 diff -u -p -r1.5 xm-rs6000.h --- config/rs6000/xm-rs6000.h 2001/07/23 19:21:57 1.5 +++ config/rs6000/xm-rs6000.h 2001/08/23 21:17:50 @@ -44,7 +44,6 @@ /* #define HAVE_TERMIO 1 */ #define USG 1 -#define HAVE_SIGSETMASK 1 #define FIVE_ARG_PTRACE