File: getsockopt.2

package info (click to toggle)
manpages-es 1.24a-6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,256 kB
  • ctags: 7
  • sloc: makefile: 66; sh: 62
file content (171 lines) | stat: -rw-r--r-- 6,518 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
168
169
170
171
.\" Copyright (c) 1983, 1991 The Regents of the University of California.
.\" 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. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"     This product includes software developed by the University of
.\"     California, Berkeley and its contributors.
.\" 4. 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.
.\"
.\"     $Id: getsockopt.2,v 1.1 1999/05/24 14:57:04 freitag Exp $
.\"
.\" Modified Sat Jul 24 16:19:32 1993 by Rik Faith (faith@cs.unc.edu)
.\" Modified Mon Apr 22 02:29:06 1996 by Martin Schulze (joey@infodrom.north.de)
.\" Modified Tue Aug 27 10:52:51 1996 by Andries Brouwer (aeb@cwi.nl)
.\" Modified Thu Jan 23 13:29:34 1997 by Andries Brouwer (aeb@cwi.nl)
.\" Translated Tue Dec 16 1997 by Gerardo Aburruzaga <gerardo.aburruzaga@uca.es> 
.\" Modified Sun Mar 28 21:26:46 1999 by Andries Brouwer (aeb@cwi.nl)
.\" Translation revised on Sun Apr 4 1999 by Juan Piernas <piernas@ditec.um.es>
.\" Modified 1999 by Andi Kleen <ak@muc.de>. Removed most stuff because it
.\" is in socket.7 now.
.\" Translation revised Sat Jun 26 1999 by Juan Piernas <piernas@ditec.um.es>
.\"
.TH GETSOCKOPT 2 "24 Mayo 1999" "Pgina man de Linux" "Manual del Programador de Linux"
.SH NOMBRE
getsockopt, setsockopt \- obtiene y pone opciones en conectores (\fIsockets\fR)
.SH SINOPSIS
.B #include <sys/types.h>
.br
.B #include <sys/socket.h>
.sp 2
.BI "int getsockopt(int " s ", int " nivel ", int " nomopc ,
.BI "void *" valopc ", socklen_t *" lonopc );
.sp
.BI "int setsockopt(int " s ", int " nivel ", int " nomopc ,
.BI "const void *" valopc ", socklen_t " lonopc );
.SH DESCRIPCIN
.B Getsockopt
y
.B setsockopt
manipulan las
.I opciones
asociadas a un conector. stas pueden existir en mltiples niveles de
protocolo; siempre estn presentes en el nivel ms alto de 
.B conector.

Al manipular opciones de conector, deben especificarse el nivel en el
que reside la opcin, y su nombre.

Para manipular opciones en el nivel de conector,
.I nivel
se especifica como
.BR SOL_SOCKET .
Para manipular opciones a cualquier otro nivel, se suministra el
nmero de protocolo del apropiado que controle la opcin. Por ejemplo,
para indicar que una opcin ha de ser interpretada por el protocolo
.BR TCP ,
.I nivel
debe ponerse como el nmero de protocolo de
.BR TCP ;
vea
.BR getprotoent (3).

Los parmetros
.I valopc
y
.I lonopc
se emplean para acceder a valores de opciones de
.BR setsockopt .
Para
.B getsockopt
identifican a un bfer en el que se pondr el valor para la opcin
pedida (u opciones). Para
.BR getsockopt ,
.I lonopc
es un parmetro por referencia, que contiene inicialmente el tamao
del bfer  apuntado por 
.IR optval ,
y que se modifica al acabar la funcin para contener el tamao real
del valor devuelto. Si no se va a suministrar o devolver un valor de
opcin, 
.I valopc
puede ser NULL.

.I Nomopc
y cualesquiera opciones especificadas se pasan sin interpretar al
mdulo de protocolo apropiado para su interpretacin. El fichero de cabecera
.I <sys/socket.h>
contiene definiciones para opciones de nivel de conector, descritas ms
abajo. Las opciones a otros niveles de protocolo varan en formato y
nombre; consulte las pginas apropiadas de la seccin 4 del Manual.

La mayora de las opciones de nivel-conector utilizan un parmetro
.I int
para
.IR valopc .
Para
.BR setsockopt ,
el parmetro debe ser distinto de cero para permitir una opcin
booleana, o cero si la opcin va a ser deshabilitada.
.PP
Para una descripcin de las opciones disponibles para conectores vea
.BR socket (7)
y las pginas de manual del protocolo apropiado.
.SH "VALOR DEVUELTO"
Se devuelve cero en caso de xito. En caso de error se devuelve \-1 y
.I errno
toma un valor apropiado.
.SH ERRORES
.TP 0.8i
.B EBADF
El argumento
.I s
no es un descriptor vlido.
.TP
.B ENOTSOCK
El argumento
.I s
es un fichero, no un conector.
.TP
.B ENOPROTOOPT
La opcin es desconocida al nivel indicado.
.TP
.B EFAULT
La direccin apuntada por
.I valopc
no est en un sitio vlido del espacio de direcciones del proceso. Para
.BR getsockopt ,
este error puede tambin ser devuelto si
.I lonopc
no est en un sitio vlido del espacio de direcciones del proceso.
.SH CONFORME A
SVr4, 4.4BSD (estas primitivas aparecieron por primera vez en 4.2BSD).
SVr4 documenta los cdigos de error adicionales ENOMEM y ENOSR, pero no
documenta las opciones 
.BR SO_SNDLOWAT ", " SO_RCVLOWAT ", " SO_SNDTIMEO " ni " SO_RCVTIMEO
.SH NOTA
El quinto argumento de
.BR getsockopt " y " setsockopt 
es en realidad un entero [*] (y esto es lo que tienen BSD 4.*, libc4 y libc5).
Cierta confusin en POSIX dio como resultado el actual socklen_t.
El estndar propuesto todava no ha sido adoptado pero glibc2 ya lo sigue y
tambin tiene socklen_t [*]. Vea tambin
.BR accept (2).
.SH FALLOS
Algunas de las opciones de conector deberan ser manejadas a niveles ms
bajos del sistema.
.SH "VASE TAMBIN"
.BR ioctl "(2), " socket "(2), " getprotoent "(3), " protocols (5)
.BR socket "(7), " unix "(7), " tcp "(7)