Provided by: manpages-es-dev_4.13-4_all bug

NOMBRE

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

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():
           Desde glibc 2.24:
               _DEFAULT_SOURCE
           From glibc 2.20 to 2.23:
               _DEFAULT_SOURCE ||
               _XOPEN_SOURCE && _XOPEN_SOURCE < 500
           Glibc 2.19 and earlier:
               _BSD_SOURCE ||
               _XOPEN_SOURCE && _XOPEN_SOURCE < 500

DESCRIPCIÓN

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

       Entonces "¿En qué fichero?" te preguntarás. Bueno, veamos 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 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 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.

       En UNIX V7 el formato se cambió: aquí el segundo caracter era un argumento a getty(8)  que
       indicaba  la  secuencia  de  velocidades  de  línea  a  probar  ('0'  era:   cicla   sobre
       300-1200-150-110  baudios; '4' 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".

       Later  systems  have  more  elaborate  syntax.   System  V-like  systems have /etc/inittab
       instead.

   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 │
       └──────────┴────────────────────┴───────────┘

CONFORME A

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

NOTAS

       El archivo utmp se encuentra en diversos  lugares  en  distintos  sistemas,  por  ejemplo:
       /etc/utmp, /var/adm/utmp, /var/run/utmp.

       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)

COLOFÓN

       Esta página es parte de la versión 5.10 del proyecto Linux man-pages. 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/.

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>

       Esta  traducción  es  documentación  libre;  lea  la  GNU General Public License Version 3
       ⟨https://www.gnu.org/licenses/gpl-3.0.html⟩ 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 ⟨⟩.