diff options
author | David Leonard <d@cvs.openbsd.org> | 1998-11-20 11:19:02 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1998-11-20 11:19:02 +0000 |
commit | f547068f88348f54941dc06da46491f99701933e (patch) | |
tree | 8548a6b78719cba1de575b7f49e5f8ac4e6f1683 /lib/libc/gen/ttyname.3 | |
parent | 394c7a9821726b84f284c0c4385b1a9198afa0b0 (diff) |
Add thread-safety to libc, so that libc_r will build (on i386 at least).
All POSIX libc api now there (to P1003.1c/D10)
(more md stuff is needed for other libc/arch/*)
(setlogin is no longer a special syscall)
Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS).
Doc some re-entrant routines
Add libc_r to intro(3)
dig() uses some libc srcs and an extra -I was needed there.
Add more md stuff to libc_r.
Update includes for the pthreads api
Update libc_r TODO
Diffstat (limited to 'lib/libc/gen/ttyname.3')
-rw-r--r-- | lib/libc/gen/ttyname.3 | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/lib/libc/gen/ttyname.3 b/lib/libc/gen/ttyname.3 index 76830b638d2..728bc1509e3 100644 --- a/lib/libc/gen/ttyname.3 +++ b/lib/libc/gen/ttyname.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ttyname.3,v 1.4 1998/06/08 17:21:45 deraadt Exp $ +.\" $OpenBSD: ttyname.3,v 1.5 1998/11/20 11:18:40 d Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -36,6 +36,7 @@ .Os .Sh NAME .Nm ttyname , +.Nm ttyname_r , .Nm isatty , .Nm ttyslot .Nd get name of associated terminal (tty) from file descriptor @@ -44,6 +45,8 @@ .Ft char * .Fn ttyname "int fd" .Ft int +.Fn ttyname_r "int fd" "char *name" "size_t namesize" +.Ft int .Fn isatty "int fd" .Ft int .Fn ttyslot "void" @@ -72,11 +75,25 @@ terminal type device. .Pp The .Fn ttyname -function -gets the related device name of +and +.Fn ttyname_r +functions +get the related device name of a file descriptor for which .Fn isatty -is true +is true. +The +.Fn ttyname_r +function stores the nul-terminated pathname of the terminal associated with +the file descriptor +.Fa fd +in the character array referenced by +.Fa name . +The array is +.Fa namesize +characters long and should have space for the name and the terminating nul +character. The maximum length of the terminal name is +.Dv TTY_NAME_MAX . .Pp The .Fn ttyslot @@ -87,8 +104,10 @@ file entry. .Sh RETURN VALUES The .Fn ttyname -function -returns the null terminated name if the device is found and +and +.Fn ttyname_r +functions +return the nul terminated name if the device is found and .Fn isatty is true; otherwise a @@ -125,6 +144,11 @@ argument is not a valid file descriptor. The .Fa fd argument does not refer to a terminal device. +.It Bq Er ERANGE +The value of +.Fa namesize +is smaller than the length of the string to be returned including the +terminating nul character. .El .Sh FILES .Bl -tag -width /etc/ttys -compact @@ -133,7 +157,8 @@ argument does not refer to a terminal device. .El .Sh SEE ALSO .Xr ioctl 2 , -.Xr ttys 5 +.Xr ttys 5 , +.Xr dev_mkdb 8 .Sh HISTORY A .Fn isatty , @@ -143,6 +168,9 @@ and function appeared in .At v7 . +The +.Fn ttyname_r +function appeared in the POSIX Threads Extension (1003.1c-1995). .Sh BUGS The .Fn ttyname |