X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 	tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Eric Blake <ebb9@byu.net>
Subject:  Re: Tried out cygwin-inst-20100111.tar.bz2
Date: Wed, 13 Jan 2010 16:04:32 +0000 (UTC)
Lines: 30
Message-ID:  <loom.20100113T165802-718@post.gmane.org>
References:  <COL102-W462D97538DD6B7BAA121D5B56C0@phx.gbl>  <20100112164834.GV14511@calimero.vinschen.de>  <COL102-W52DB3A5D272B9E630D808EB56C0@phx.gbl>  <20100113110729.GX14511@calimero.vinschen.de>  <4B4DCB0C.9040402@byu.net> <20100113140642.GZ14511@calimero.vinschen.de>
Mime-Version:  1.0
Content-Type:  text/plain; charset=us-ascii
Content-Transfer-Encoding:  7bit
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:

> 
> IIU the SUSv4 description C, and given that a newly opened console is
> always setup with the default termios settings anyway, we could simply
> set O_TTY_INIT to 0 and be done with it:

Yep, that's my understanding as well.  This link is also informative:

http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap11.html#tag_11_02

"Since the termios structure may include additional members, and the standard 
members may include both standard and non-standard modes, the structure should 
never be initialized directly by the application as this may cause the terminal 
to behave in a non-conforming manner. When opening a terminal device (other 
than a pseudo-terminal) that is not already open in any process, it should be 
opened with the O_TTY_INIT flag before initializing the structure using 
tcgetattr( ) to ensure that any non-standard elements of the termios structure 
are set to values that result in conforming behavior of the terminal interface."

In other words, tcsetattr should always be used on a struct termios obtained 
from a read-modify-write manner, and never from a memset(0) manner, where the 
use of O_TTY_INIT guarantees (trivially, if it is defined to 0) that any 
extension fields in struct termios that need to be set to a non-zero value for 
POSIX conformance are set correctly.

-- 
Eric Blake




--
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

