From owner-freebsd-stable@FreeBSD.ORG Thu Oct 25 07:45:13 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9B39EC6; Thu, 25 Oct 2012 07:45:13 +0000 (UTC) (envelope-from edschouten@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 478348FC14; Thu, 25 Oct 2012 07:45:12 +0000 (UTC) Received: by mail-ob0-f182.google.com with SMTP id wc20so1671861obb.13 for ; Thu, 25 Oct 2012 00:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=jXEpe7KOj3g/pmeBQpTZ2OkGRltjDYScm9rvbskhEAI=; b=txKbqjGnmG0ZDxSg0Z6HWC+6lenVCLd5MW0Zwyl+SpdWBP74EDQnuKV9An06xNAqKb G9kuMQmFfHpQyEDTCXsc2SIgXBOy8mauuvGaNBrrLOhsB9ne/95F/D6zM13r5qap1S9q NVj3ZE5OBzEx9JBErst067jtkvPlyOLEo2V1hjDxj59TcZXX5vZMLlDvt+zupMheFidJ qLq4nh/qcRGIX9Oj0hQMV0mV/E4M9QTPcJcUrW7vN/g8NOHVv3eE+eS3T+9U76QJ107Z hZhGa61zi5XGVR7v5rGnqzFu1FwEbXq/3tJnlrQD5OMv6Zw8zbxKwEOxpJOwoe2n9gTK LRtQ== MIME-Version: 1.0 Received: by 10.60.171.10 with SMTP id aq10mr15358844oec.131.1351151111547; Thu, 25 Oct 2012 00:45:11 -0700 (PDT) Sender: edschouten@gmail.com Received: by 10.76.151.39 with HTTP; Thu, 25 Oct 2012 00:45:11 -0700 (PDT) In-Reply-To: References: <20121023142703.GA79098@icarus.home.lan> <20121023203928.GZ35915@deviant.kiev.zoral.com.ua> Date: Thu, 25 Oct 2012 09:45:11 +0200 X-Google-Sender-Auth: GhFMA-b27N5IrAUpu2sz42LL2n0 Message-ID: Subject: Re: pty/tty or signal strangeness, or grep/bsdgrep bug? From: Ed Schouten To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 Cc: Jeremy Chadwick , freebsd-stable@freebsd.org, jhb@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Oct 2012 07:45:13 -0000 Hi all, 2012/10/23 Ed Schouten : > Will try to come up with a decent patch tomorrow evening. Ahem; the day after tomorrow. Jeremy, could you please try the following patch? http://80386.nl/pub/tty-bg-read.txt I decomposed the TTY read routine into four separate functions to improve clarity. While this was initially true, I think it's a pity the four functions are constantly becoming a bit more complex. The same issue is also present on the output path, but I have no idea how realistic/hard it is to fix this issue. Also, it might not really be an issue in practice. If you do a large write and become a non-foreground process group, you might be able to circumvent TOSTOP while the write() is in transit. Fixing this might be tedious, because we currently enforce that writes to a TTY are serialized. Blocking inside the write() might then cause a deadlock. But in my opinion, I would prefer the serialization over the enforcing of TOSTOP. Thanks again for reporting the issue! -- Ed Schouten