From patchwork Thu Oct 9 19:33:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 3182 Received: (qmail 7105 invoked by alias); 9 Oct 2014 19:33:32 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 7036 invoked by uid 89); 9 Oct 2014 19:33:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath To: Florian Weimer Cc: "GNU C. Library" Subject: Re: [PATCH roland/sigvec] Remove sigvec. In-Reply-To: Florian Weimer's message of Monday, 6 October 2014 11:44:32 +0200 <54326480.30109@redhat.com> References: <20141003224414.3445F2C3A61@topped-with-meat.com> <54326480.30109@redhat.com> Message-Id: <20141009193327.B7BD02C3ACF@topped-with-meat.com> Date: Thu, 9 Oct 2014 12:33:27 -0700 (PDT) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=Z6MIti7PxpgA:10 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=eZ3ulLdO8V5L6CotZZ0A:9 a=CjuIK1q_8ugA:10 > Uhm, the current lv package in Fedora and Debian uses it: Indeed. Surprising. The use of SV_INTERRUPT means it would actually change the behavior to simply start failing that configure check and use plain signal instead of sigvec. (signal by default is equivalent to sigaction using SA_RESTART; SV_INTERRUPT is the inverse of SA_RESTART.) It's of course a simple 5-minute job to convert any old use of sigvec to use sigaction instead. I did it for lv and the patch is below. Would you like to take care of sending that to the lv maintainer and/or using it in the Fedora package? This is a case where the plain removal of sigvec would not have broken the package's build and would instead have subtly changed the behavior of the program. So it certainly seems like a red flag. But I'm not sure that a staged deprecation plan would do any better on that score. There would be compile-time warnings about using a deprecated interface, but that would not have broken the package's build either. Perhaps distros will (should? do?) build with -Werror=deprecated-declarations specifically to ensure such things get caught. Do you think we should do a staged deprecation for sigvec instead? Thanks, Roland --- ./src/configure.in.~1~ 2004-01-04 22:35:44.000000000 -0800 +++ ./src/configure.in 2014-10-09 11:14:47.782210631 -0700 @@ -34,7 +34,7 @@ AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys dnl Checks for typedefs, structures, and compiler characteristics. dnl Checks for library functions. -AC_CHECK_FUNCS(sigvec tgetnum setlocale) +AC_CHECK_FUNCS(sigaction tgetnum setlocale) AC_FUNC_GETPGRP AC_PROG_GCC_TRADITIONAL AC_TYPE_SIGNAL --- ./src/console.c.~1~ 2004-01-04 23:27:46.000000000 -0800 +++ ./src/console.c 2014-10-09 11:16:59.627943378 -0700 @@ -158,9 +158,9 @@ private RETSIGTYPE InterruptHandler( int { kb_interrupted = TRUE; -#ifndef HAVE_SIGVEC +#ifndef HAVE_SIGACTION signal( SIGINT, InterruptHandler ); -#endif /* HAVE_SIGVEC */ +#endif /* HAVE_SIGACTION */ } public void ConsoleEnableInterrupt() @@ -235,9 +235,9 @@ private RETSIGTYPE WindowChangeHandler( ConsoleGetWindowSize(); -#ifndef HAVE_SIGVEC +#ifndef HAVE_SIGACTION signal( SIGWINCH, WindowChangeHandler ); -#endif /* HAVE_SIGVEC */ +#endif /* HAVE_SIGACTION */ } #endif /* UNIX */ @@ -388,24 +388,24 @@ public void ConsoleSetUp() signal( SIGINT, InterruptIgnoreHandler ); #endif /* MSDOS */ -#ifdef HAVE_SIGVEC - struct sigvec sigVec; +#ifdef HAVE_SIGACTION + struct sigaction sa; - sigVec.sv_handler = WindowChangeHandler; - sigVec.sv_mask = sigmask( SIGWINCH ); - sigVec.sv_flags = SV_INTERRUPT; - sigvec( SIGWINCH, &sigVec, NULL ); - - sigVec.sv_handler = InterruptHandler; - sigVec.sv_mask = sigmask( SIGINT ); - sigVec.sv_flags = SV_INTERRUPT; - sigvec( SIGINT, &sigVec, NULL ); + sa.sa_handler = WindowChangeHandler; + sigemptyset( &sa.sa_mask ); + sa.sa_flags = 0; /* No SA_RESTART means interrupt syscalls. */ + sigaction( SIGWINCH, &sa, NULL ); + + sa.sa_handler = InterruptHandler; + sigemptyset( &sa.sa_mask ); + sa.sa_flags = 0; /* No SA_RESTART means interrupt syscalls. */ + sigaction( SIGINT, &sa, NULL ); #else # ifdef SIGWINCH signal( SIGWINCH, WindowChangeHandler ); # endif signal( SIGINT, InterruptHandler ); -#endif /* HAVE_SIGVEC */ +#endif /* HAVE_SIGACTION */ #ifdef UNIX #ifdef HAVE_TERMIOS_H