From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6209 invoked by alias); 26 Apr 2013 15:08:12 -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: 17787 Received: (qmail 8800 invoked from network); 26 Apr 2013 15:08:11 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130426080805.ZM18619@torch.brasslantern.com> Date: Fri, 26 Apr 2013 08:08:05 -0700 In-reply-to: Comments: In reply to "Yuri D'Elia" "Re: precmd: write error: interrupted" (Apr 25, 10:05pm) References: <130425111646.ZM17258@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: precmd: write error: interrupted MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Apr 25, 10:05pm, 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?). } } What other syscalls would be interrupted by SIGWINCH that shouldn't be } restarted? Right now I cannot think of anything that SIGWINCH should } interrupt. I've been thinking about this, and the problem with using SA_RESTART is twofold: (1) [Minor] Some platforms don't have restartable syscalls, so this won't work everywhere. But perhaps the intersection of non-restarable syscalls and support for SIGWINCH is empty. (2) [Potentially major] A user-defined trap can be installed for the SIGWINCH signal. That means arbitrary shell code might execute during handling of the signal, so all sorts of things might happen mid-write, not just the default ioctls. We're not especially POSIX-beholden but it would also be best if we can preserve the POSIX rules governing trap handlers. There may not be any conflict with that here, but it needs to be kept in mind. } [1] interestingly enough, why "interact" is tested for the Sunos4 case? I have a vague recollection that it has something to do with the way STREAMS i/o drivers interoperate with terminals, but I could be entirely wrong.