From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3300 invoked by alias); 25 Apr 2013 20:58:21 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17783 Received: (qmail 3066 invoked from network); 25 Apr 2013 20:58:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_NUMERIC_HELO,SPF_HELO_PASS autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at m.gmane.org designates 80.91.229.3 as permitted sender) X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Yuri D'Elia Subject: Re: precmd: write error: interrupted Date: Thu, 25 Apr 2013 22:58:05 +0200 Message-ID: References: <130425111646.ZM17258@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090407000200030500070708" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 193.106.183.18 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 In-Reply-To: --------------090407000200030500070708 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 04/25/2013 10:05 PM, Yuri D'Elia wrote: > I actually tried to set SA_RESTART only when installing the handler for > SIGWINCH when debugging [1]. It works in this case, but I'm not entirely > sure it is side-effect free (is doing an ioctl on the tty safe while > mid-write?). Attached. --------------090407000200030500070708 Content-Type: text/x-patch; name="restart-sigwinch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="restart-sigwinch.diff" --- signals.c.Orig 2013-04-25 22:34:36.342080454 +0200 +++ signals.c 2013-04-25 22:55:15.994027929 +0200 @@ -112,9 +112,18 @@ act.sa_handler = (SIGNAL_HANDTYPE) zhandler; sigemptyset(&act.sa_mask); /* only block sig while in handler */ act.sa_flags = 0; -# ifdef SA_INTERRUPT /* SunOS 4.x */ - if (interact) - act.sa_flags |= SA_INTERRUPT; /* make sure system calls are not restarted */ +# if defined(SIGWINCH) && defined(SA_RESTART) + if (sig == SIGWINCH) { + act.sa_flags |= SA_RESTART; + } else { +# ifdef SA_INTERRUPT /* SunOS 4.x */ + act.sa_flags |= SA_INTERRUPT; /* make sure system calls are not restarted */ +# endif + } +# else +# ifdef SA_INTERRUPT /* SunOS 4.x */ + act.sa_flags |= SA_INTERRUPT; /* make sure system calls are not restarted */ +# endif # endif sigaction(sig, &act, (struct sigaction *)NULL); #else @@ -122,9 +131,13 @@ struct sigvec vec; vec.sv_handler = (SIGNAL_HANDTYPE) zhandler; - vec.sv_mask = sigmask(sig); /* mask out this signal while in handler */ -# ifdef SV_INTERRUPT - vec.sv_flags = SV_INTERRUPT; /* make sure system calls are not restarted */ + vec.sv_mask = sigmask(sig); /* mask out this signal while in handler */ +# if defined(SIGWINCH) && defined(SV_INTERRUPT) + if (sig != SIGWINCH) { + vec.sv_flags = SV_INTERRUPT; /* make sure system calls are not restarted */ + } +# elif defined(SV_INTERRUPT) + vec.sv_flags = SV_INTERRUPT; /* make sure system calls are not restarted */ # endif sigvec(sig, &vec, (struct sigvec *)NULL); # else --------------090407000200030500070708--