man-pages/man3/ptsname.3

99 lines
2.1 KiB
Groff
Raw Normal View History

2004-11-03 13:51:07 +00:00
.\" Hey Emacs! This file is -*- nroff -*- source.
.\" This page is in the public domain. - aeb
.\"
2004-12-17 11:22:41 +00:00
.\" 2004-12-17, mtk, added description of ptsname_r() + ERRORS
.\"
.TH PTSNAME 3 2008-09-03 "" "Linux Programmer's Manual"
2004-11-03 13:51:07 +00:00
.SH NAME
ptsname, ptsname_r \- get the name of the slave pseudoterminal
2004-11-03 13:51:07 +00:00
.SH SYNOPSIS
.nf
.B #define _XOPEN_SOURCE
.br
.B #include <stdlib.h>
.sp
.BI "char *ptsname(int " fd ");"
2004-12-17 11:22:41 +00:00
.sp
.B #define _GNU_SOURCE
.br
.B #include <stdlib.h>
.sp
.BI "int ptsname_r(int " fd ", char *" buf ", size_t " buflen ");"
2004-11-03 13:51:07 +00:00
.fi
.SH DESCRIPTION
The
.BR ptsname ()
function returns the name of the slave pseudoterminal device
2004-12-17 11:22:41 +00:00
corresponding to the master referred to by
2004-11-03 13:51:07 +00:00
.IR fd .
2004-12-17 11:22:41 +00:00
The
.BR ptsname_r ()
function is the reentrant equivalent of
.BR ptsname ().
It returns the name of the slave pseudoterminal device as a
2004-12-17 11:22:41 +00:00
null-terminated string in the buffer pointed to by
.IR buf .
The
.I buflen
argument specifies the number of bytes available in
.IR buf .
2004-11-03 13:51:07 +00:00
.SH "RETURN VALUE"
2004-12-17 11:22:41 +00:00
On success,
2004-11-03 13:51:07 +00:00
.BR ptsname ()
2004-12-17 11:22:41 +00:00
returns a pointer to a string in static storage which will be
overwritten by subsequent calls.
This pointer must not be freed.
On failure, a NULL pointer is returned.
On success,
.BR ptsname_r ()
returns 0.
intro.1, time.1, adjtimex.2, capget.2, eventfd.2, fcntl.2, getrlimit.2, getsockopt.2, gettimeofday.2, intro.2, ioctl_list.2, ioperm.2, mlock.2, pivot_root.2, poll.2, prctl.2, ptrace.2, sched_setscheduler.2, select_tut.2, semget.2, sigaltstack.2, signalfd.2, sysctl.2, timer_settime.2, timerfd_create.2, wait.2, CPU_SET.3, argz_add.3, assert_perror.3, atexit.3, backtrace.3, bcmp.3, clearenv.3, ctime.3, dl_iterate_phdr.3, dlopen.3, ecvt.3, errno.3, error.3, ether_aton.3, exit.3, fenv.3, ferror.3, finite.3, flockfile.3, fnmatch.3, fpathconf.3, fpclassify.3, ftime.3, ftok.3, ftw.3, fwide.3, getaddrinfo.3, gethostbyname.3, getlogin.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getrpcent.3, getservent.3, glob.3, hsearch.3, inet.3, isalpha.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, longjmp.3, lsearch.3, malloc.3, matherr.3, mblen.3, mbsinit.3, mbtowc.3, on_exit.3, printf.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_equal.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setschedparam.3, pthread_setschedprio.3, ptsname.3, putenv.3, putgrent.3, raise.3, rcmd.3, regex.3, rexec.3, rpc.3, rpmatch.3, rtnetlink.3, scandir.3, sem_init.3, setaliasent.3, setbuf.3, setenv.3, setjmp.3, signbit.3, stdio_ext.3, strtod.3, strtol.3, strtoul.3, system.3, termios.3, timeradd.3, tzset.3, ualarm.3, wctomb.3, xdr.3, st.4, tty_ioctl.4, core.5, elf.5, proc.5, bootparam.7, capabilities.7, icmp.7, ip.7, ipv6.7, math_error.7, mdoc.samples.7, mq_overview.7, pthreads.7, raw.7, regex.7, socket.7, tcp.7, tzselect.8: Global fix: s/non-zero/nonzero/ The tendency in English, as prescribed in style guides like Chicago MoS, is towards removing hyphens after prefixes like "non-" etc. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:40:55 +00:00
On failure, a nonzero value is returned
2004-12-17 11:22:41 +00:00
and
.I errno
is set to indicate the error.
.\" In fact the errno value is also returned as the function
.\" result -- MTK, Dec 04
.SH ERRORS
.TP
.B EINVAL
.RB ( ptsname_r ()
only)
.I buf
is NULL.
.TP
.B ENOTTY
.I fd
does not refer to a pseudoterminal master device.
2004-12-17 11:22:41 +00:00
.TP
.B ERANGE
.RB ( ptsname_r ()
only)
.I buf
is too small.
2008-06-11 13:43:34 +00:00
.SH VERSIONS
.BR ptsname ()
is provided in glibc since version 2.1.
2004-11-03 13:51:07 +00:00
.SH "CONFORMING TO"
2004-12-17 11:22:41 +00:00
.BR ptsname ()
is part of the UNIX 98 pseudoterminal support (see
2004-12-17 11:22:41 +00:00
.BR pts (4)).
2006-08-03 13:57:30 +00:00
This function is specified in POSIX.1-2001.
2004-12-17 11:22:41 +00:00
2005-04-18 13:35:29 +00:00
.BR ptsname_r ()
2004-12-17 11:22:41 +00:00
is a Linux extension.
2004-12-17 12:40:52 +00:00
A version of this function is documented on Tru64 and HP-UX, but
2005-06-15 14:10:23 +00:00
on those implementations, \-1 is returned on error, with
2004-12-17 11:22:41 +00:00
.I errno
set to indicate the error.
Avoid using this function in portable programs.
2004-11-03 13:51:07 +00:00
.SH "SEE ALSO"
.BR grantpt (3),
2004-12-17 12:46:00 +00:00
.BR posix_openpt (3),
2004-11-03 13:51:07 +00:00
.BR ttyname (3),
2004-12-17 12:46:00 +00:00
.BR unlockpt (3),
2005-10-10 13:14:12 +00:00
.BR pts (4),
2007-01-28 20:00:24 +00:00
.BR feature_test_macros (7),
2005-10-10 13:14:12 +00:00
.BR pty (7)