From owner-svn-src-all@freebsd.org Mon May 8 08:36:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C93A4D6231E; Mon, 8 May 2017 08:36:57 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4329A12C2; Mon, 8 May 2017 08:36:57 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm0-x22d.google.com with SMTP id u65so75964637wmu.1; Mon, 08 May 2017 01:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=6SWSqDUSfZj0yHEZuC17pzVo4sMggYyh2GQUu+Ae8sc=; b=Z9udk75vcqAA/VuEZCMmnwQjfl6Ke7qXAwNkHwqP8N+xrYKvqnbVMzRA16o5taq3sQ mBtjxozB+cWFJraMoLkoT/JolUZofGXO/fhzhmyTIjfQjTFNJ5BS7HE/+GFaH8JfbBhw qf9tyozgPcca28wYpsMKD2s9oC/w8XIfOy/eBfzpiNtCnDPpOkc5igPXfSSMX57xVCi6 wcWq+HGrQe7MALTu9oOC+Q3SWkhVgQHYeNV33x35/MaXX/hAGDY0G8+10BYScATxSd8V 09o6YNnIAuUV07WnPrNpetXqWanldDC8HqhYWWHG5X8yeTFy0pgo4OsPL7zGvBeRM1Ni AvZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=6SWSqDUSfZj0yHEZuC17pzVo4sMggYyh2GQUu+Ae8sc=; b=Nj1d2VAznBVvS4u6dQDeeJ6LL1Ks9WNrZwSytypz4S8hRRyxnRIuQGY+C2OjwTNlDe z9xyZ/w4GQDL9vQYT393OshDSsWaWHDQn7UX4m8YtLoUdyXu3ST5WTc/XmKELhwWBDYn CTZhsna/T8lzyWLMcWgG6Pt++CQyZ2w07uDmEsIX8VfC5+p+fgCll4v0GGCBXhdO6Lfb Ss4viX3drp2nJ1NndCwOw2aYYsvL5tp40R6hJcLTAm4j8EWicGhrq1btUq7ojr2DvvMK oyAfhCAdEs/w1NYvt2S8w5CEQ6vOnKiCQOHkwj9L5gIx1yfIgf3wsNvgTARJLzswN7eD T3yA== X-Gm-Message-State: AODbwcCGr/HZb5Ec1IMWR1HXZGSANIcjHZHdo2rQ2fZoUDqzMU3F/ULX yJ438qqV8iRWjiHh X-Received: by 10.28.46.143 with SMTP id u137mr11316832wmu.56.1494232615575; Mon, 08 May 2017 01:36:55 -0700 (PDT) Received: from brick (cpc92310-cmbg19-2-0-cust934.5-4.cable.virginm.net. [82.9.227.167]) by smtp.gmail.com with ESMTPSA id 133sm12213296wms.22.2017.05.08.01.36.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 01:36:55 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Mon, 8 May 2017 09:36:52 +0100 From: Edward Tomasz Napierala To: Jilles Tjoelker Cc: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317909 - head/usr.bin/resizewin Message-ID: <20170508083652.GB1437@brick> Mail-Followup-To: Jilles Tjoelker , Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201705071721.v47HLNWB049018@repo.freebsd.org> <20170507180143.GA1622@kib.kiev.ua> <20170507182802.GA5248@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170507182802.GA5248@stack.nl> User-Agent: Mutt/1.8.2 (2017-04-18) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 May 2017 08:36:57 -0000 On 0507T2028, Jilles Tjoelker wrote: > On Sun, May 07, 2017 at 09:01:43PM +0300, Konstantin Belousov wrote: > > On Sun, May 07, 2017 at 05:21:23PM +0000, Edward Tomasz Napierala wrote: > > > Author: trasz > > > Date: Sun May 7 17:21:22 2017 > > > New Revision: 317909 > > > URL: https://svnweb.freebsd.org/changeset/base/317909 > > > > Log: > > > Make resizewin(1) discard the terminal queues, to lower the chance > > > for "unable to parse response" error which happens when youre typing > > > too fast for the machine you're running it on. > > > > Reviewed by: cem, Daniel O'Connor > > > MFC after: 2 weeks > > > Sponsored by: DARPA, AFRL > > > Differential Revision: https://reviews.freebsd.org/D10624 > > > > Modified: > > > head/usr.bin/resizewin/resizewin.c > > > > > > Modified: head/usr.bin/resizewin/resizewin.c > > > ============================================================================== > > > --- head/usr.bin/resizewin/resizewin.c Sun May 7 14:59:45 2017 (r317908) > > > +++ head/usr.bin/resizewin/resizewin.c Sun May 7 17:21:22 2017 (r317909) > > > @@ -52,7 +52,7 @@ main(__unused int argc, __unused char ** > > > { > > > struct termios old, new; > > > struct winsize w; > > > - int ret, fd, cnt, error; > > > + int ret, fd, cnt, error, what; > > > char data[20]; > > > struct timeval then, now; > > > > > > @@ -71,6 +71,12 @@ main(__unused int argc, __unused char ** > > > if (tcsetattr(fd, TCSANOW, &new) == -1) > > > exit(1); > > > > > > + /* Discard input received so far */ > > > + what = FREAD | FWRITE; > > > + error = ioctl(fd, TIOCFLUSH, &what); > > This is correctly spelled tcflush(fd, TCIOFLUSH); > > Alternatively, the above TCSANOW could be changed to TCSAFLUSH. The > effect is slightly different in that pending output is drained instead > of discarded. > > In any case, the TIOCFLUSH ioctl is non-standard and should not be used > directly. I've changed it to use tcflush(3), as suggested by kib@, as it keeps the current (tested) behaviour. I'll try to investigate TCSANOW as well, thanks!