ttyname(3)


NAME

   ttyname, ttyname_r - return name of a terminal

SYNOPSIS

   #include <unistd.h>

   char *ttyname(int fd);

   int ttyname_r(int fd, char *buf, size_t buflen);

DESCRIPTION

   The  function  ttyname()  returns  a  pointer  to  the  null-terminated
   pathname of the terminal device that is open on the file descriptor fd,
   or  NULL  on error (for example, if fd is not connected to a terminal).
   The return value may point to static data, possibly overwritten by  the
   next call.  The function ttyname_r() stores this pathname in the buffer
   buf of length buflen.

RETURN VALUE

   The function ttyname() returns a pointer to a pathname on success.   On
   error,  NULL is returned, and errno is set appropriately.  The function
   ttyname_r() returns 0 on success, and an error number upon error.

ERRORS

   EBADF  Bad file descriptor.

   ENOTTY File descriptor does not refer to a terminal device.

   ERANGE (ttyname_r())  buflen  was  too  small  to  allow  storing   the
          pathname.

ATTRIBUTES

   For   an   explanation   of   the  terms  used  in  this  section,  see
   attributes(7).

   
   Interface    Attribute      Value                  
   
   ttyname()    Thread safety  MT-Unsafe race:ttyname 
   
   ttyname_r()  Thread safety  MT-Safe                
   

CONFORMING TO

   POSIX.1-2001, POSIX.1-2008, 4.2BSD.

SEE ALSO

   tty(1), fstat(2), ctermid(3), isatty(3)

COLOPHON

   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at
   https://www.kernel.org/doc/man-pages/.


More Linux Commands

manpages/labs.3.html
labs(3) - compute the absolute value of an integer (ManPage)
The abs() function computes the absolute value of the integer argument j. The labs(), llabs() and imaxabs() functions compute the absolute value of the argument

manpages/arpd.8.html
arpd(8) - userspace arp daemon. (Admin - Linux man page)....
The arpd daemon collects gratuitous ARP information, saving it on local disk and feeding it to the kernel on demand to avoid redundant broadcasting due to limit

manpages/fsck.msdos.8.html
fsck.msdos(8) - check and repair MS-DOS filesystems.........
fsck.fat verifies the consistency of MS-DOS filesystems and optionally tries to repair them. The following filesystem problems can be corrected (in this order):

manpages/envz_strip.3.html
envz_strip(3) - environment string support - Linux man page
These functions are glibc-specific. An argz vector is a pointer to a character buffer together with a length, see argz_add(3). An envz vector is a special argz

manpages/XtAppInitialize.3.html
XtAppInitialize(3) - initialize, open, or close a display...
The XtAppInitialize function calls XtToolkitInitialize followed by XtCreateApplicationContext, then calls XtOpenDisplay with display_string NULL and application

manpages/XF86DGA.3.html
XF86DGA(3) - Client library for the XFree86-DGA extension.
The XFree86-DGA extension is an X server extension for allowing client programs direct access to the video frame buffer. This is a brief description of the prog

manpages/gnutls_x509_crt_set_key_usage.3.html
gnutls_x509_crt_set_key_usage(3) - API function (Man Page)
This function will set the keyUsage certificate extension. RETURNS On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value. REPORTING BUG

manpages/SDL_SetGammaRamp.3.html
SDL_SetGammaRamp(3) - Sets the color gamma lookup tables for
Sets the gamma lookup tables for the display for each color component. Each table is an array of 256 Uint16 values, representing a mapping between the input and

manpages/git-svn.1.html
git-svn(1) Bidirectional operation between a Subversion repo
git svn is a simple conduit for changesets between Subversion and Git. It provides a bidirectional flow of changes between a Subversion and a Git repository. gi

manpages/groff_font.5.html
groff_font(5) - format of groff device and font description
The groff font format is roughly a superset of the ditroff font format. The font files for device name are stored in a directory devname. There are two types of

manpages/vfs_crossrename.8.html
vfs_crossrename(8) - server side rename files across filesys
This VFS module is part of the samba(7) suite. The vfs_crossrename VFS module allows server side rename operations even if source and target are on different ph

manpages/systemd-system.conf.5.html
systemd-system.conf(5) System and session service manager co
systemd-system.conf.5 - When run as system instance systemd reads the configuration file system.conf, otherwise user.conf. These configuration files contain a f





We can't live, work or learn in freedom unless the software we use is free.