ttyslot(3) Library Functions Manual ttyslot(3) ttyslot - C (libc, -lc) #include /* See NOTES */ int ttyslot(void); glibc (. feature_test_macros(7)): ttyslot(): Since glibc 2.24: _DEFAULT_SOURCE From glibc 2.20 to glibc 2.23: _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) glibc 2.19 and earlier: _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) ttyslot() . << ?>> -- . , . There used to be a file /etc/ttys in UNIX V6, that was read by the init(1) program to find out what to do with each terminal line. Each line consisted of three characters. The first character was either '0' or '1', where '0' meant "ignore". The second character denoted the terminal: '8' stood for "/dev/tty8". The third character was an argument to getty(8) indicating the sequence of line speeds to try ('-' was: start trying 110 baud). Thus a typical line was "18-". A hang on some line was solved by changing the '1' to a '0', signaling init, changing back again, and signaling init again. In UNIX V7 the format was changed: here the second character was the argument to getty(8) indicating the sequence of line speeds to try ('0' was: cycle through 300-1200-150-110 baud; '4' was for the on-line console DECwriter) while the rest of the line contained the name of the tty. Thus a typical line was "14console". . , System V, /etc/inittab. (2) , /etc/utmp, , . login(1). , login(1) ttyslot() /etc/ttys ( 1). ttyslot , ttyslot() /etc/ttys , (), /etc/utmp. BSD /etc/ttys , System V , - . , ttyslot() . If successful, this function returns the slot number. On error (e.g., if none of the file descriptors 0, 1, or 2 is associated with a terminal that occurs in this data base) it returns 0 on UNIX V6 and V7 and BSD-like systems, but -1 on System V-like systems. attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |ttyslot() | | MT-Unsafe | +----------------------------+----------------------------------------------------------+--------------------------+ utmp : /etc/utmp, /var/adm/utmp, /var/run/utmp. None. SUSv1; SUSv2 ; POSIX.1-2001. SUSv2 -1 . glibc2 _PATH_TTYS, <>. 0. Linux <> , 0. BSD- Linux ttyslot() . System V- . glibc 2.24 : (_XOPEN_SOURCE >= 500 || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)) && ! (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) Minix fttyslot(fd). getttyent(3), ttyname(3), utmp(5) () Azamat Hackimov , Dmitry Bolkhovskikh , Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.9.1 2 2024 . ttyslot(3)