Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ttyname(3c) [hpux man page]

ttyname(3C)															       ttyname(3C)

NAME
ttyname(), ttyname_r(), isatty() - find name of a terminal SYNOPSIS
DESCRIPTION
returns a pointer to a string containing the null-terminated path name of the terminal device associated with file descriptor fildes. returns 1 if fildes is associated with a terminal device, 0 otherwise. Reentrant Interfaces returns the result string in the supplied buffer. The buffer is buflen characters long and should have space for the name and the terminat- ing null character. The maximum length of the terminal name is RETURN VALUE
returns a NULL pointer if fildes does not describe a terminal device in directory returns a zero upon success and an error number upon failure. ERRORS
and fail if any of the following conditions are encountered: The fildes argument is invalid. An inappropriate I/O control operation has been attempted. APPLICATION USAGE
The return value for points to static data whose content is overwritten by each call. WARNINGS
For streams ptys, and do not consider master ptys to be tty devices. It should also be noted that returns a pointer to the master pty name for all master pty devices. This is a result of device files being linked together. Users of should also note that the prototype of this function has changed in this release for conformance with the POSIX.1c Threads stan- dard. The old prototype of is supported for compatibility with existing DCE applications only. FILES
SEE ALSO
thread_safety(5). STANDARDS CONFORMANCE
ttyname(3C)

Check Out this Related Man Page

ttyname(3C)															       ttyname(3C)

NAME
ttyname, ttyname_r - find pathname of a terminal SYNOPSIS
#include <unistd.h> char *ttyname(int fildes); char *ttyname_r(int fildes, char *name, int namelen); Standard conforming cc [ flag...] file ... -D_POSIX_PTHREAD_SEMANTICS [ library ... ] int ttyname_r(int fildes, char *name, size_t namesize); The ttyname() function returns a pointer to a string containing the null-terminated path name of the terminal device associated with file descriptor fildes. The return value points to thread-specific data whose content is overwritten by each call from the same thread. The ttyname_r() function has the same functionality as ttyname() except that the caller must supply a buffer name with length namelen to store the result; this buffer must be at least _POSIX_PATH_MAX in size (defined in <limits.h>). The standard-conforming version (see stan- dards(5)) of ttyname_r() takes a namesize parameter of type size_t. Upon successful completion, ttyname() and ttyname_r() return a pointer to a string. Otherwise, a null pointer is returned and errno is set to indicate the error. The standard-conforming ttyname_r() returns 0 if successful or the error number upon failure. The ttyname() and ttyname_r() functions may fail if: EBADF The fildes argument is not a valid file descriptor. This condition is reported. ENOTTY The fildes argument does not refer to a terminal device. This condition is reported. The ttyname_r() function may fail if: ERANGE The value of namesize is smaller than the length of the string to be returned including the terminating null character. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ Intro(3), gettext(3C), setlocale(3C), attributes(5), standards(5) When compiling multithreaded applications, see Intro(3), Notes On Multithreaded Applications. Messages printed from this function are in the native language specified by the LC_MESSAGES locale category. See setlocale(3C). The return value of ttyname() points to thread-specific data whose content is overwritten by each call from the same thread. This function is safe to use in multithreaded applications, but its use is discouraged. The ttyname_r() function should used instead. Solaris 2.4 and earlier releases provided definitions of the ttyname_r() interface as specified in POSIX.1c Draft 6. The final POSIX.1c standard changed the interface as described above. Support for the Draft 6 interface is provided for compatibility only and might not be supported in future releases. New applications and libraries should use the standard-conforming interface. 31 Mar 2005 ttyname(3C)
Man Page