text: Section (3) ttyname
  Name
  ttyname, ttyname_r — return name of a terminal
  Synopsis
  #include <unistd.h>
  DESCRIPTIONODEV
  File descriptor refers to a slave pseudoterminal device but the corresponding pathname could not be found (see NOTES).
  - ENOTTY
  File descriptor does not refer to a terminal device.
  - ERANGE
  ttyname_r())
  buflenwas too small to allow storing the pathname.
  ATTRIBUTES
  For an explanation of the terms used in this section, see attributes(7).
  NOTES_zsingle_quotesz_t be used to access the
  device that the file descriptor refers to. Calling
  ttyname() or
  ttyname_r() on the file descriptor in the
  new mount namespace will cause these functions to return NULL
  and set
  errno to ENODEV.
  SEE ALSO
  tty(1), fstat(2), ctermid(3), isatty(3), pts(4)