NAME |LIBRARY |SYNOPSIS |DESCRIPTION |ATTRIBUTES |STANDARDS |NOTES |SEE ALSO |COLOPHON | |
getttyent(3) Library Functions Manualgetttyent(3)getttyent, getttynam, setttyent, endttyent - get ttys file entry
Standard C library (libc,-lc)
#include <ttyent.h>struct ttyent *getttyent(void);struct ttyent *getttynam(const char *name);int setttyent(void);int endttyent(void);
These functions provide an interface to the file_PATH_TTYS(e.g.,/etc/ttys). The functionsetttyent() opens the file or rewinds it if already open. The functionendttyent() closes the file. The functiongetttynam() searches for a given terminal name in the file. It returns a pointer to attyent structure (description below). The functiongetttyent() opens the file_PATH_TTYS(if necessary) and returns the first entry. If the file is already open, the next entry. Thettyent structure has the form: struct ttyent { char *ty_name; /* terminal device name */ char *ty_getty; /* command to execute, usually getty */ char *ty_type; /* terminal type for termcap */ int ty_status; /* status flags */ char *ty_window; /* command to start up window manager */ char *ty_comment; /* comment field */ };ty_status can be: #define TTY_ON 0x01 /* enable logins (start ty_getty program) */ #define TTY_SECURE 0x02 /* allow UID 0 to login */For an explanation of the terms used in this section, seeattributes(7). ┌────────────────────────┬───────────────┬───────────────────────┐ │Interface│Attribute│Value│ ├────────────────────────┼───────────────┼───────────────────────┤ │getttyent(), │ Thread safety │ MT-Unsafe race:ttyent │ │setttyent(), │ │ │ │endttyent(), │ │ │ │getttynam() │ │ │ └────────────────────────┴───────────────┴───────────────────────┘
BSD.
Under Linux, the file/etc/ttys, and the functions described above, are not used.
ttyname(3),ttyslot(3)
This page is part of theman-pages (Linux kernel and C library user-space interface documentation) project. Information about the project can be found at ⟨https://www.kernel.org/doc/man-pages/⟩. If you have a bug report for this manual page, see ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩. This page was obtained from the tarball man-pages-6.15.tar.gz fetched from ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on 2025-08-11. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up- to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgLinux man-pages 6.15 2025-05-17getttyent(3)Pages that refer to this page:ttyslot(3)
HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |