.\" Copyright (c) OpenBSD Group .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" Converted into a manpage again by Martin Schulze .\" .\" Traducido por Miguel Pérez Ibars el 9-agosto-2004 .\" .TH OPENPTY 3 "13 diciembre 2001" "BSD MANPAGE" "Manual del Programador de Linux" .SH NOMBRE openpty, login_tty, forkpty \- utilidades tty .SH SINOPSIS .B #include \ /* para openpty y forkpty */ .br .B #include /* para login_tty */ .sp .BI "int openpty(int *" amaster ", int *" aslave ", char *" name ", struct termios *" termp ", struct winsize * " winp ); .sp .BI "int login_tty(int " fd ); .sp .BI "pid_t forkpty(int *" amaster ", char *" name ", struct termios *" termp ", struct winsize *" winp ); .SH DESCRIPCIÓN La función .B openpty() busca una pseudo-tty disponible y devuelve los descriptores de fichero para la pty maestra y esclava en .I amaster y .IR aslave . Si .I name es distinto de NULL, el nombre de fichero de la pty esclava se devuelve en .IR name . Si .I termp es distinto de NULL, se asignará a los parámetros de terminal de la pty esclava los valores en .IR termp . Si .I winp es distinto de NULL, el tamaño de la ventana de la pty esclava se fijará con los valores en .IR winp . La función .B login_tty() prepara un inicio de sesión en la tty .I fd (que puede ser un dispositivo tty real, o la pty esclava de una pseudo-tty devuelta por .BR openpty() ) creando una nueva sesión, haciendo que .I fd sea la terminal de control del proceso actual, poniendo .I fd como entrada, salida y salida de error estándar del proceso actual, y cerrando .IR fd . La función .B forkpty() combina .BR openpty() , .BR fork() , y .B login_tty() para crear un nuevo proceso operando en una pseudo-tty. El descriptor de fichero del lado maestro de la pseudo-tty es devuelto en .IR amaster , y el nombre de fichero de la pty esclava en .I name si éste no es NULL. Los parámetros .I termp y .I winp , si no son NULL, determinarán los atributos de la terminal y el tamaño de la ventana del lado esclavo de la pseudo-tty. .SH "VALOR DEVUELTO" Si una llamada a .BR openpty() , .BR login_tty() , o .B forkpty() no tiene éxito, se devuelve -1 y se modifica .I errno para indicar el error. En otro caso, .BR openpty() , .BR login_tty() , y el proceso hijo de .B forkpty() devuelven 0, y el proceso padre de .B forkpty() devuelve el identificador de proceso del proceso hijo. .SH ERRORES .B openpty() fallará si: .TP .B ENOENT No hay ttys disponibles. .LP .B login_pty() fallará si .B ioctl() falla al poner a .I fd como terminal de control del proceso actual. .LP .B forkpty() fallará si .B openpty() o .B fork() fallan. .SH FICHEROS .I /dev/[pt]ty[pqrstuwxyzabcdePQRST][0123456789abcdef] .SH "CONFORME A" Éstas son funciones de BSD, presentes en libc5 y glibc2. .SH "VÉASE TAMBIÉN" .BR fork (2)