Provided by: manpages-es-dev_4.27.0-1_all bug

NOMBRE

       ttyslot - encuentra la posición de la terminal de usuario actual en algún archivo

BIBLIOTECA

       Biblioteca Estándar C (libc, -lc)

SINOPSIS

       #include <unistd.h> /* Vea NOTAS */

       int ttyslot(void);

   Requisitos de Macros de Prueba de Características para glibc (véase 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)

DESCRIPCIÓN

       La función histórica ttyslot()  devuelve el índice de la entrada de usuario actual en algún archivo.

       Entonces "¿En qué archivo?" se preguntará. Bueno, veamos primero algo de historia.

   Historia Antigua
       Solía  haber  un  archivo /etc/ttys en UNIX V6, que era leído por el programa init(1)  para descubrir qué
       hacer con cada línea terminal.  Cada línea consistía en tres caracteres.  El primer  carácter  podía  ser
       '0'  o  bien  '1',  donde  '0''  significaba  "ignorar".   El  segundo carácter denotaba la terminal: '8'
       significaba "/dev/tty8".  El tercer carácter era un argumento para getty(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.

       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 más modernos tienen sintaxis más elaborada.  Los sistemas tipo System-V tienen  /etc/inittab  en
       su lugar.

   Historia Antigua (2)
       Por  otro lado, está el archivo /etc/utmp que listaba las personas que estaban conectadas en ese momento.
       Es mantenido por login(1).  Tiene un tamaño fijo, y el índice apropiado en el archivo estaba  determinado
       por login(1)  usando la llamada ttyslot()  para hallar el número de la línea en /etc/ttys (contando desde
       1).

   La semántica 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 explicación de los términos usados en esta sección, véase attributes(7).
       ┌──────────────────────────────────────────────────────────────────────┬────────────────────┬───────────┐
       │ InterfazAtributoValor     │
       ├──────────────────────────────────────────────────────────────────────┼────────────────────┼───────────┤
       │ 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.

ESTÁNDARES

       None.

HISTORIAL

       SUSv1; marked as LEGACY in SUSv2; removed in POSIX.1-2001.  SUSv2 requires -1 on error.

       La  implementación  de  glibc2  de  esta  función  lee el archivo _PATH_TTYS, definido en <ttyent.h> como
       "/etc/ttys". Devuelve 0 en caso de error.  Como los sistemas Linux no suelen tener  "/etc/ttys",  siempre
       devolverá 0.

       On BSD-like systems and Linux, the declaration of ttyslot()  is provided by <unistd.h>.  On System V-like
       systems,  the  declaration  is  provided  by  <stdlib.h>.  Since glibc 2.24, <stdlib.h> 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 también tiene fttyslot(fd).

VÉASE TAMBIÉN

       getttyent(3), ttyname(3), utmp(5)

TRADUCCIÓN

       La traducción al español de esta página del  manual  fue  creada  por  Jorge  Rodriguez  (A.K.A.  Tiriel)
       <tiriel@users.sourceforge.net> y Marcos Fouces <marcos@debian.org>

       Esta  traducción  es  documentación  libre;  lea  la GNU General Public License Version 3 o posterior con
       respecto a las condiciones de copyright.  No existe NINGUNA RESPONSABILIDAD.

       Si encuentra algún error en la traducción de esta página  del  manual,  envíe  un  correo  electrónico  a
       debian-l10n-spanish@lists.debian.org.

Páginas de Manual de Linux 6.9.1                   2 Mayo 2024                                        ttyslot(3)