From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24646 invoked by alias); 27 Nov 2011 20:40:29 -0000 Received: (qmail 24637 invoked by uid 22791); 27 Nov 2011 20:40:28 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 Nov 2011 20:40:15 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pARKeFpw015652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 27 Nov 2011 15:40:15 -0500 Received: from host1.jankratochvil.net (ovpn-116-40.ams2.redhat.com [10.36.116.40]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pARKeDDM010286 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 27 Nov 2011 15:40:14 -0500 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id pARKeC6S014241; Sun, 27 Nov 2011 21:40:12 +0100 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id pARKeB1C014240; Sun, 27 Nov 2011 21:40:11 +0100 Date: Sun, 27 Nov 2011 20:40:00 -0000 From: Jan Kratochvil To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [RFC] Don't immediately SIGTERM the child of "target remote |". Message-ID: <20111127204011.GA4606@host1.jankratochvil.net> References: <20111124000052.14DC12461B1@ruffy.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111124000052.14DC12461B1@ruffy.mtv.corp.google.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-11/txt/msg00742.txt.bz2 On Thu, 24 Nov 2011 01:00:51 +0100, Doug Evans wrote: [...] > - int status; > - kill (state->pid, SIGTERM); > + int rc, status; > + void (*ofunc) (); /* Previous SIGALRM handler. */ ^int (or void) > + > + /* Don't kill the task right away, give it a chance to shut down cleanly. > + But don't wait forever though. */ > +#if defined (HAVE_SIGACTION) && defined (SA_RESTART) > + { > + struct sigaction sa, osa; > + sa.sa_handler = sigalrm_handler; > + sigemptyset (&sa.sa_mask); > + sa.sa_flags = 0; > + sigaction (SIGALRM, &sa, &osa); > + ofunc = osa.sa_handler; > + } > +#else > + ofunc = (void (*)()) signal (SIGALRM, sigalrm_handler); > +#endif [...] > + alarm (0); > + signal (SIGALRM, ofunc); You should restore OSA, not just OFUNC. Thanks, Jan