From: Yuri D'Elia <wavexx@users.sourceforge.net>
To: zsh-users@zsh.org
Subject: Re: precmd: write error: interrupted
Date: Thu, 25 Apr 2013 22:58:05 +0200 [thread overview]
Message-ID: <klc5co$k35$1@ger.gmane.org> (raw)
In-Reply-To: <klc2ah$jiv$1@ger.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 290 bytes --]
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.
[-- Attachment #2: restart-sigwinch.diff --]
[-- Type: text/x-patch, Size: 1654 bytes --]
--- 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
next prev parent reply other threads:[~2013-04-25 20:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-25 16:47 Yuri D'Elia
2013-04-25 17:44 ` Yuri D'Elia
2013-04-25 18:27 ` Bart Schaefer
2013-04-25 18:16 ` Bart Schaefer
2013-04-25 18:38 ` Peter Stephenson
2013-04-25 22:18 ` Bart Schaefer
2013-04-26 0:52 ` Bart Schaefer
2013-04-25 19:38 ` Yuri D'Elia
2013-04-26 0:53 ` Bart Schaefer
2013-04-25 20:05 ` Yuri D'Elia
2013-04-25 20:58 ` Yuri D'Elia [this message]
2013-04-26 15:08 ` Bart Schaefer
[not found] ` <130426080805.ZM18619__18102.73175729$1366989065$gmane$org@torch.brasslantern.com>
2013-04-26 17:59 ` Yuri D'Elia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='klc5co$k35$1@ger.gmane.org' \
--to=wavexx@users.sourceforge.net \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).