.\" -*- coding: UTF-8 -*- .\" Copyright (C) 2002 Andries Brouwer .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" This replaces an earlier man page written by Walter Harms .\" . .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH TTYSLOT 3 "15 Septiembre 2017" GNU "Manual del Programador de Linux" .SH NOMBRE ttyslot \- encuentra la posición de la terminal de usuario actual en algún archivo .SH SINOPSIS \fB#include \fP /* Vea NOTAS */ .PP \fBint ttyslot(void);\fP .PP .RS -4 Requisitos de Macros de Prueba de Características para glibc (véase \fBfeature_test_macros\fP(7)): .RE .PP .ad l \fBttyslot\fP(): .RS 4 Desde glibc 2.24: _DEFAULT_SOURCE .br From glibc 2.20 to 2.23: _DEFAULT_SOURCE || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE\ <\ 500 .br Glibc 2.19 and earlier: _BSD_SOURCE || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE\ <\ 500 .RE .ad b .SH DESCRIPCIÓN La función histórica \fBttyslot\fP() devuelve el índice de la entrada de usuario actual en algún archivo. .PP Entonces "¿En qué archivo?" se preguntará. Bueno, veamos primero algo de historia. .SS "Historia Antigua" Solía haber un archivo \fI/etc/ttys\fP en UNIX V6, que era leído por el programa \fBinit\fP(1) para descubrir qué hacer con cada línea terminal. Cada línea consistía en tres caracteres. El primer caracter podía ser '0' ó '1', donde '0' significaba "ignorar". El segundo caracter denotaba la terminal: \&'8' significaba "/dev/tty8". El tercer caracter era un argumento para \fBgetty\fP(8) que indicaba la secuencia de velocidades de línea a probar ('\-' era: comienza a probar 110 baudios). De modo que la típica línea era "18\-". Un cuelgue en alguna línea se resolvía cambiando el '1' a '0', señalando a init, cambiando otra vez, y volviendo a señalar a init de nuevo. .PP En UNIX\ V7 el formato se cambió: aquí el segundo caracter era un argumento a \fBgetty\fP(8) que indicaba la secuencia de velocidades de línea a probar (\(aq0\(aq era: cicla sobre 300\-1200\-150\-110 baudios; \(aq4\(aq se destinaba a la consola en línea DECwriter) mientras que el resto de la línea contenía el nombre del tty. De modo que una línea típica era "14console". .PP Sistemas más modernos tienen sintaxis más elaborada. Los sistemas tipo System\-V tienen \fI/etc/inittab\fP en su lugar. .SS "Historia Antigua (2)" Por otro lado, está el archivo \fI/etc/utmp\fP que listaba las personas que estaban conectadas en ese momento. Es mantenido por \fBlogin\fP(1). Tiene un tamaño fijo, y el índice apropiado en el archivo estaba determinado por \fBlogin\fP(1) usando la llamada \fBttyslot\fP() para hallar el número de la línea en \fI/etc/ttys\fP (contando desde 1). .SS "La semántica de ttyslot" Thus, the function \fBttyslot\fP() returns the index of the controlling terminal of the calling process in the file \fI/etc/ttys\fP, and that is (usually) the same as the index of the entry for the current user in the file \fI/etc/utmp\fP. BSD still has the \fI/etc/ttys\fP file, but System V\-like systems do not, and hence cannot refer to it. Thus, on such systems the documentation says that \fBttyslot\fP() returns the current user's index in the user accounting data base. .SH "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. .SH ATRIBUTOS Para obtener una explicación de los términos usados en esta sección, véase \fBattributes\fP(7). .TS allbox; lb lb lb l l l. Interfaz Atributo Valor T{ \fBttyslot\fP() T} Seguridad del hilo MT\-Unsafe .TE .SH "CONFORME A" SUSv1; marked as LEGACY in SUSv2; removed in POSIX.1\-2001. SUSv2 requires \-1 on error. .SH NOTAS El archivo utmp se encuentra en diversos lugares en distintos sistemas, por ejemplo: \fI/etc/utmp\fP, \fI/var/adm/utmp\fP, \fI/var/run/utmp\fP. .PP La implementación de glibc2 de esta función lee el archivo \fB_PATH_TTYS\fP, definido en \fI\fP como "/etc/ttys". Devuelve 0 en caso de error. Como los sistemas Linux no suelen tener "/etc/ttys", siempre devolverá 0. .PP On BSD\-like systems and Linux, the declaration of \fBttyslot\fP() is provided by \fI\fP. On System V\-like systems, the declaration is provided by \fI\fP. Since glibc 2.24, \fI\fP also provides the declaration with the following feature test macro definitions: .PP .in +4n .EX (_XOPEN_SOURCE >= 500 || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)) && ! (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) .EE .in .PP .\" .SH HISTORY .\" .BR ttyslot () .\" appeared in UNIX V7. Minix también tiene \fIfttyslot\fP(\fIfd\fP). .SH "VÉASE TAMBIÉN" \fBgetttyent\fP(3), \fBttyname\fP(3), \fButmp\fP(5) .SH COLOFÓN Esta página es parte de la versión 5.10 del proyecto Linux \fIman\-pages\fP. Puede encontrar una descripción del proyecto, información sobre cómo informar errores y la última versión de esta página en \%https://www.kernel.org/doc/man\-pages/. .PP .SH TRADUCCIÓN La traducción al español de esta página del manual fue creada por Jorge Rodriguez (A.K.A. Tiriel) y Marcos Fouces . .PP Esta traducción es documentación libre; lea la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. .PP Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a .MT debian-l10n-spanish@lists.debian.org .ME .