ttyslot(3) Library Functions Manual ttyslot(3) NOMBRE ttyslot - encuentra la posicion de la terminal de usuario actual en algun archivo BIBLIOTECA Biblioteca Estandar C (libc, -lc) SINOPSIS #include /* Vea NOTAS */ int ttyslot(void); Requisitos de Macros de Prueba de Caracteristicas para glibc (vease feature_test_macros(7)): ttyslot(): A partir de glibc 2.24: _DEFAULT_SOURCE Desde glibc 2.20 hasta glibc 2.23: _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) glibc 2.19 y anteriores: _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) DESCRIPCION La funcion historica ttyslot() devuelve el indice de la entrada de usuario actual en algun archivo. Entonces "?En que archivo?" se preguntara. Bueno, veamos primero algo de historia. Historia Antigua Solia haber un archivo /etc/ttys en UNIX V6, que era leido por el programa init(1) para descubrir que hacer con cada linea terminal. Cada linea consistia en tres caracteres. El primer caracter podia ser '0' o bien '1', donde '0'' significaba "ignorar". El segundo caracter denotaba la terminal: '8' significaba "/dev/tty8". El tercer caracter era un argumento para getty(8) que indicaba la secuencia de velocidades de linea a probar ('-' era: comienza a probar 110 baudios). De modo que la tipica linea era "18-". Un cuelgue en alguna linea se resolvia cambiando el '1' a '0', senalando a init, cambiando otra vez, y volviendo a senalar a init de nuevo. 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". Sistemas mas modernos tienen sintaxis mas elaborada. Los sistemas tipo System-V tienen /etc/inittab en su lugar. Historia Antigua (2) Por otro lado, esta el archivo /etc/utmp que listaba las personas que estaban conectadas en ese momento. Es mantenido por login(1). Tiene un tamano fijo, y el indice apropiado en el archivo estaba determinado por login(1) usando la llamada ttyslot() para hallar el numero de la linea en /etc/ttys (contando desde 1). La semantica de ttyslot Thus, the function ttyslot() returns the index of the controlling terminal of the calling process in the file /etc/ttys, and that is (usually) the same as the index of the entry for the current user in the file /etc/utmp. BSD still has the /etc/ttys file, but System V-like systems do not, and hence cannot refer to it. Thus, on such systems the documentation says that ttyslot() returns the current user's index in the user accounting data base. VALOR DEVUELTO 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. ATRIBUTOS Para obtener una explicacion de los terminos usados en esta seccion, vease attributes(7). +-------------------------------------+--------------------+-----------+ |Interfaz | Atributo | Valor | +-------------------------------------+--------------------+-----------+ |ttyslot() | Seguridad del hilo | MT-Unsafe | +-------------------------------------+--------------------+-----------+ VERSIONES El archivo utmp se encuentra en diversos lugares en distintos sistemas, por ejemplo: /etc/utmp, /var/adm/utmp, /var/run/utmp. ESTANDARES None. HISTORIAL SUSv1; marked as LEGACY in SUSv2; removed in POSIX.1-2001. SUSv2 requires -1 on error. La implementacion de glibc2 de esta funcion lee el archivo _PATH_TTYS, definido en como "/etc/ttys". Devuelve 0 en caso de error. Como los sistemas Linux no suelen tener "/etc/ttys", siempre devolvera 0. On BSD-like systems and Linux, the declaration of ttyslot() is provided by . On System V-like systems, the declaration is provided by . Since glibc 2.24, also provides the declaration with the following feature test macro definitions: (_XOPEN_SOURCE >= 500 || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)) && ! (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) Minix tambien tiene fttyslot(fd). VEASE TAMBIEN getttyent(3), ttyname(3), utmp(5) TRADUCCION La traduccion al espanol de esta pagina del manual fue creada por Jorge Rodriguez (A.K.A. Tiriel) y Marcos Fouces Esta traduccion es documentacion libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. Si encuentra algun error en la traduccion de esta pagina del manual, envie un correo electronico a . Paginas de manual de Linux 6.06 31 Octubre 2023 ttyslot(3)