From owner-svn-src-head@FreeBSD.ORG Sat Feb 28 10:10:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BABCD106566C; Sat, 28 Feb 2009 10:10:30 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F3B48FC13; Sat, 28 Feb 2009 10:10:30 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1SAAUJ5002207; Sat, 28 Feb 2009 10:10:30 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1SAAUhD002205; Sat, 28 Feb 2009 10:10:30 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200902281010.n1SAAUhD002205@svn.freebsd.org> From: Ed Schouten Date: Sat, 28 Feb 2009 10:10:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189143 - in head: lib/libc/sys sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Feb 2009 10:10:31 -0000 Author: ed Date: Sat Feb 28 10:10:30 2009 New Revision: 189143 URL: http://svn.freebsd.org/changeset/base/189143 Log: Add missing POSIX 1003.1-2008 open(2) flag; O_TTY_INIT. On FreeBSD, this is the default behaviour. According to the spec, we may give this flag a value of zero, but I'd rather not do this. If we define it to a non-zero value, we can always change default behaviour without changing the ABI. This is very unlikely to happen, though. Modified: head/lib/libc/sys/open.2 head/sys/sys/fcntl.h Modified: head/lib/libc/sys/open.2 ============================================================================== --- head/lib/libc/sys/open.2 Sat Feb 28 06:39:39 2009 (r189142) +++ head/lib/libc/sys/open.2 Sat Feb 28 10:10:30 2009 (r189143) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd April 10, 2008 +.Dd February 28, 2009 .Dt OPEN 2 .Os .Sh NAME @@ -116,6 +116,7 @@ O_FSYNC synchronous writes O_SYNC synchronous writes O_NOFOLLOW do not follow symlinks O_NOCTTY don't assign controlling terminal +O_TTY_INIT restore default terminal attributes .Ed .Pp Opening a file with @@ -208,6 +209,19 @@ The system call will not assign controlling terminals on .Fx . .Pp +.Dv O_TTY_INIT +may be used to ensure the OS restores the terminal attributes when +initially opening a TTY. +This is the default on +.Fx , +but is present for +.Tn POSIX +compatibility. +The initial call to +.Fn open +on a TTY will always restore default terminal attributes on +.Fx . +.Pp If successful, .Fn open returns a non-negative integer, termed a file descriptor. Modified: head/sys/sys/fcntl.h ============================================================================== --- head/sys/sys/fcntl.h Sat Feb 28 06:39:39 2009 (r189142) +++ head/sys/sys/fcntl.h Sat Feb 28 10:10:30 2009 (r189143) @@ -140,6 +140,11 @@ typedef __pid_t pid_t; #define FEXEC O_EXEC #endif +/* Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. */ +#if __POSIX_VISIBLE >= 200809 +#define O_TTY_INIT 0x00080000 /* Restore default termios attributes */ +#endif + /* * XXX missing O_DSYNC, O_RSYNC. */