X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org X-Yahoo-SMTP: jenXL62swBAWhMTL3wnej93oaS0ClBQOAKs8jbEbx_o- Date: Tue, 10 May 2011 13:18:47 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: Who's using "CYGWIN=tty" and why? Message-ID: <20110510171846.GA27537@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20110509161028 DOT GJ27739 AT calimero DOT vinschen DOT de> <0105D5C1E0353146B1B222348B0411A209E8030CB9 AT NIHMLBX02 DOT nih DOT gov> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0105D5C1E0353146B1B222348B0411A209E8030CB9@NIHMLBX02.nih.gov> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Tue, May 10, 2011 at 09:37:43AM -0400, Buchbinder, Barry (NIH/NIAID) [E] wrote: >Corinna Vinschen sent the following at Monday, May 09, 2011 12:10 PM >>Chris and I are wondering how many people are using the Windows console >>as local console window in CYGWIN=tty mode and why. > >I've been using it for so long that I do not remember why - probably >because I thought it was recommended. > >I did some testing yesterday and found that with CYGWIN=tty each >console gets a unique number, as visible in /bin/tty, ps, and >$(cat /proc/$$/ctty). Without it, one gets "con" (tty and ps) or a >long, nonunique number (/proc). I use the tty number to keep track >of console windows. If we changed the /dev/console to /dev/consN (where N is a unique number for each console window) would that address your use case? You would not be able to do something like echo foo >/dev/cons4 and have foo be echoed another console window though. >In the past, I've played with minty and haven't felt the need to >switch. I did an abbreviated test (just ps) with minty and it had >tty numbers without CYGWIN=tty. I think Corinna and I both suffered from the misperception that people were familiar with Cygwin's handling of ttys. mintty uses ptys. Cygwin's ttys and ptys are pretty much the same thing. Cygwin ttys have some extra handshaking which slows down I/O somewhat wrt ptys. And, using CYGWIN=tty means setting up extra threads in the first process starting in a console window. So, yes, you'll see /dev/ttyN as the controlling terminal in a tty application. It was in a discussion with Corinna where I was contemplating eliminating the handshaking that Corinna asked the fateful "Why do we need CYGWIN=tty" question. Eliminating the special case of tty handling would simplify the cygwin pty layer, shrink the size of the DLL, and generally make Cygwin a little easier to maintain. cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple