From owner-svn-src-head@FreeBSD.ORG  Fri Jul 18 21:29:59 2014
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id C3DB4B1E;
 Fri, 18 Jul 2014 21:29:59 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B14ED20FE;
 Fri, 18 Jul 2014 21:29:59 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6ILTxRu098437;
 Fri, 18 Jul 2014 21:29:59 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
 by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6ILTxxI098436;
 Fri, 18 Jul 2014 21:29:59 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201407182129.s6ILTxxI098436@svn.freebsd.org>
From: Jilles Tjoelker <jilles@FreeBSD.org>
Date: Fri, 18 Jul 2014 21:29:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r268857 - head/lib/libc/gen
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 18 Jul 2014 21:29:59 -0000

Author: jilles
Date: Fri Jul 18 21:29:59 2014
New Revision: 268857
URL: http://svnweb.freebsd.org/changeset/base/268857

Log:
  ttyname(3): Fix EBADF/ENOTTY error descriptions.
  
  Also, make sure to document the return values and errors for all three
  functions in the man page.
  
  PR:		191931
  MFC after:	1 week

Modified:
  head/lib/libc/gen/ttyname.3

Modified: head/lib/libc/gen/ttyname.3
==============================================================================
--- head/lib/libc/gen/ttyname.3	Fri Jul 18 21:28:59 2014	(r268856)
+++ head/lib/libc/gen/ttyname.3	Fri Jul 18 21:29:59 2014	(r268857)
@@ -28,7 +28,7 @@
 .\"     @(#)ttyname.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd May 14, 2005
+.Dd July 18, 2014
 .Dt TTYNAME 3
 .Os
 .Sh NAME
@@ -76,6 +76,14 @@ function
 takes a buffer and length as arguments to avoid this problem.
 .Sh RETURN VALUES
 The
+.Fn isatty
+function returns 1 if
+.Fa fd
+refers to a terminal type device;
+otherwise, it returns 0 and may set
+.Va errno
+to indicate the error.
+The
 .Fn ttyname
 function
 returns the null terminated name if the device is found and
@@ -89,15 +97,23 @@ The
 function returns 0 if successful.
 Otherwise an error number is returned.
 .Sh ERRORS
-The
-.Fn ttyname_r
-may fail and return the following error codes:
+These functions may fail if:
 .Bl -tag -width Er
-.It Bq Er ENOTTY
+.It Bq Er EBADF
 The
 .Fa fd
 argument
 is not a valid file descriptor.
+.It Bq Er ENOTTY
+The file associated with
+.Fa fd
+is not a terminal.
+.El
+.Pp
+Additionally,
+.Fn ttyname_r
+may fail if:
+.Bl -tag -width Er
 .It Bq Er ERANGE
 The
 .Fa bufsize