File: openpty.3

package info (click to toggle)
manpages-es 1.55-9
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 7,468 kB
  • ctags: 6
  • sloc: sh: 1,629; makefile: 64
file content (144 lines) | stat: -rw-r--r-- 4,364 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
.\" 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 <joey@infodrom.org>
.\"
.\" Traducido por Miguel Pérez Ibars <mpi79470@alu.um.es> 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 <pty.h>
\ /* para openpty y forkpty */
.br
.B #include <utmp.h>
/* 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)