aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/gen/ttyname.3
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2014-07-18 21:29:59 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2014-07-18 21:29:59 +0000
commitbecf52016399a97aaf4ce2bf8d0f7c96a414ef5d (patch)
tree8d3a74ddecc252683abd7423d3a9a762476704a5 /lib/libc/gen/ttyname.3
parentcd01c7a84f4bb072dc43f63fd679f06dd682a6db (diff)
downloadsrc-becf52016399a97aaf4ce2bf8d0f7c96a414ef5d.tar.gz
src-becf52016399a97aaf4ce2bf8d0f7c96a414ef5d.zip
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
Notes
Notes: svn path=/head/; revision=268857
Diffstat (limited to 'lib/libc/gen/ttyname.3')
-rw-r--r--lib/libc/gen/ttyname.326
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/libc/gen/ttyname.3 b/lib/libc/gen/ttyname.3
index 9420bbe8f9e4..9e8a4f099598 100644
--- a/lib/libc/gen/ttyname.3
+++ b/lib/libc/gen/ttyname.3
@@ -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