File: fcntl.2

package info (click to toggle)
manpages-es 0.4a-2
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 3,592 kB
  • ctags: 3
  • sloc: sh: 59; makefile: 42
file content (167 lines) | stat: -rw-r--r-- 4,624 bytes parent folder | download
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
.\"                               1993 Michael Haardt, Ian Jackson.
.\"
.\" 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.
.\"
.\" Modified Sat Jul 24 13:39:26 1993 by Rik Faith (faith@cs.unc.edu)
.\" Translated 22 Dec 1995 Miguel A. Sepulveda (miguel@typhoon.harvard.edu)
.\" Modified 1 Jul 1996 Miguel A. Sepulveda (angel@vivaldi.princeton.edu)
.TH FCNTL 2 "1 Julio 1996" Linux "Manual del Programador Linux"
.SH NOMBRE
fcntl \- manipula el descriptor de fichero
.SH SINOPSIS
.nf
.B #include <unistd.h>
.B #include <fcntl.h>
.sp
.BI "int fcntl(int " fd ", int " cmd );
.BI "int fcntl(int " fd ", int " cmd ", long " arg );
.fi
.SH DESCRIPCIN
.B fcntl
realiza una de las diversas operaciones miscelaneas en
.IR fd .
La operacin en cuestin est determinada mediante
.IR cmd :
.TP 0.9i
F_DUPFD
Hace que 
.I arg
sea una copia de
.IR fd ,
es necesario cerrar 
.I fd
en primer lugar.
.sp
El mismo resultado se puede obtener fcilmente usando        
.BR dup2 .
.sp
Los descriptores antiguo y nuevo pueden usarse indistintamente. Ambos
comparten candados (locks), punteros de posicin de ficheros 
(file position pointers) y banderas (flags); por ejemplo,
si la posicin del fichero se modifica usando
.B lseek
en uno de los descriptores, la posicin del otro resulta modificada   
simultaneamente.
.sp
Sin embargo, los dos descriptores no comparten la bandera close-on-exec
"cerrar-en-ejecucin".
.sp
En caso de xito, se regresa un nuevo descriptor.
.TP
F_GETFD
Lee la bandera close-on-exec. Si el bit de bajo-orden es 0, el fichero 
permanecer abierto durante
.BR exec ,
en caso contrario se cerrar el fichero.
.TP
F_SETFD
Asigna el valor de la bandera close-on-exec al valor especificado por 
.I arg
(solamente se usa el bit menos significativo).

.TP
F_GETFL
Lee las banderas del descriptor (todas las banderas, segn 
asignadas por
.BR open (2)
sern regresadas).
.TP
F_SETFL
Asignar las banderas del descriptor al valor asignado por
.IR arg .
Slo
.BR O_APPEND " y  " O_NONBLOCK
pueden asignarse.
.sp
Las banderas se comparten entre copias (hechas con
.B dup
etc.) del mismo descriptor de fichero.
.sp
Las banderas y su semntica estn descritas en 
.BR open (2).
.TP
F_GETLK, F_SETLK, and F_SETLKW
Dirige candados de ficheros discrecionarios (discretionary file locks).
.TP
F_GETOWN
Obtiene el ID del proceso (o grupo de procesos) del dueo de un
zcalo (socket).
.sp
Grupos de procesos regresan como valores negativos.
.TP
F_SETOWN
Asigna el proceso o grupo de procesos propietarios de un interruptor.
.sp
Para estas directivas, "propiedad"
significa recivir una seal
.B SIGIO

.B SIGURG
.sp
Grupos de procesos regresan como valores negativos.
.SH "VALOR REGRESADO"
El valor regresado depende de la operacin:
.TP 0.9i
F_DUPFD
El nuevo descriptor.
.TP
F_GETFD
Valor de la bandera.
.TP
F_GETFL
Valor de las banderas.
.TP
F_GETOWN
Valor del propietario del descriptor.
.PP
En caso de error el valor regresado es \-1, y 
.I errno
es asignado apropiadamente.
.SH ERRORES
.TP 0.9i
.B EBADF
.I fs
no es un descriptor de fichero abierto.
.TP
.B EINVAL
Para
.BR F_DUPFD ,
.I arg
es negativo o mayor que el valor mximo permitido.          
.TP
.B EINVAL
Para
.BR F_DUPFD ,
el proceso ya tiene el nmero mximo de descriptores de ficheros abiertos.
.SH NOTAS
Los errores regresados por
.B dup2
son distintos de aquellos dados por 
.BR F_DUPFD .
.SH "CONFORMA CON"
SVID, AT&T, POSIX, X/OPEN, BSD 4.3
.SH "VASE TAMBIN"
.BR open "(2), "
.BR F_DUPFD "(2), " F_GETFD "(2), " F_GETFL "(2), " F_GETLK "(2), "
.BR socket "(2). "