Deleted Added
full compact
getsockopt.2 (108028) getsockopt.2 (108087)
1.\" Copyright (c) 1983, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95
1.\" Copyright (c) 1983, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95
33.\" $FreeBSD: head/lib/libc/sys/getsockopt.2 108028 2002-12-18 09:22:32Z ru $
33.\" $FreeBSD: head/lib/libc/sys/getsockopt.2 108087 2002-12-19 09:40:28Z ru $
34.\"
35.Dd May 2, 1995
36.Dt GETSOCKOPT 2
37.Os
38.Sh NAME
39.Nm getsockopt ,
40.Nm setsockopt
41.Nd get and set options on sockets

--- 32 unchanged lines hidden (view full) ---

74.Tn TCP
75protocol,
76.Fa level
77should be set to the protocol number of
78.Tn TCP ;
79see
80.Xr getprotoent 3 .
81.Pp
34.\"
35.Dd May 2, 1995
36.Dt GETSOCKOPT 2
37.Os
38.Sh NAME
39.Nm getsockopt ,
40.Nm setsockopt
41.Nd get and set options on sockets

--- 32 unchanged lines hidden (view full) ---

74.Tn TCP
75protocol,
76.Fa level
77should be set to the protocol number of
78.Tn TCP ;
79see
80.Xr getprotoent 3 .
81.Pp
82The parameters
82The
83.Fa optval
84and
85.Fa optlen
83.Fa optval
84and
85.Fa optlen
86arguments
86are used to access option values for
87.Fn setsockopt .
88For
89.Fn getsockopt
90they identify a buffer in which the value for the
91requested option(s) are to be returned. For
92.Fn getsockopt ,
93.Fa optlen
87are used to access option values for
88.Fn setsockopt .
89For
90.Fn getsockopt
91they identify a buffer in which the value for the
92requested option(s) are to be returned. For
93.Fn getsockopt ,
94.Fa optlen
94is a value-result parameter, initially containing the
95is a value-result argument, initially containing the
95size of the buffer pointed to by
96.Fa optval ,
97and modified on return to indicate the actual size of
98the value returned. If no option value is
99to be supplied or returned,
100.Fa optval
101may be NULL.
102.Pp
96size of the buffer pointed to by
97.Fa optval ,
98and modified on return to indicate the actual size of
99the value returned. If no option value is
100to be supplied or returned,
101.Fa optval
102may be NULL.
103.Pp
103.Fa Optname
104The
105.Fa optname
106argument
104and any specified options are passed uninterpreted to the appropriate
105protocol module for interpretation.
106The include file
107.Ao Pa sys/socket.h Ac
108contains definitions for
109socket level options, described below.
110Options at other protocol levels vary in format and
111name; consult the appropriate entries in
112section
1134 of the manual.
114.Pp
115Most socket-level options utilize an
107and any specified options are passed uninterpreted to the appropriate
108protocol module for interpretation.
109The include file
110.Ao Pa sys/socket.h Ac
111contains definitions for
112socket level options, described below.
113Options at other protocol levels vary in format and
114name; consult the appropriate entries in
115section
1164 of the manual.
117.Pp
118Most socket-level options utilize an
116.Fa int
117parameter for
119.Vt int
120argument for
118.Fa optval .
119For
120.Fn setsockopt ,
121.Fa optval .
122For
123.Fn setsockopt ,
121the parameter should be non-zero to enable a boolean option,
124the argument should be non-zero to enable a boolean option,
122or zero if the option is to be disabled.
123.Dv SO_LINGER
124uses a
125or zero if the option is to be disabled.
126.Dv SO_LINGER
127uses a
125.Fa struct linger
126parameter, defined in
128.Vt "struct linger"
129argument, defined in
127.Ao Pa sys/socket.h Ac ,
128which specifies the desired state of the option and the
129linger interval (see below).
130.Dv SO_SNDTIMEO
131and
132.Dv SO_RCVTIMEO
133use a
130.Ao Pa sys/socket.h Ac ,
131which specifies the desired state of the option and the
132linger interval (see below).
133.Dv SO_SNDTIMEO
134and
135.Dv SO_RCVTIMEO
136use a
134.Fa struct timeval
135parameter, defined in
137.Vt "struct timeval"
138argument, defined in
136.Ao Pa sys/time.h Ac .
137.Pp
138The following options are recognized at the socket level.
139Except as noted, each may be examined with
140.Fn getsockopt
141and set with
142.Fn setsockopt .
143.Bl -column SO_ACCEPTFILTER -offset indent

--- 128 unchanged lines hidden (view full) ---

272or the requested amount.
273Receive calls may still return less than the low water mark if an error
274occurs, a signal is caught, or the type of data next in the receive queue
275is different from that which was returned.
276.Pp
277.Dv SO_SNDTIMEO
278is an option to set a timeout value for output operations.
279It accepts a
139.Ao Pa sys/time.h Ac .
140.Pp
141The following options are recognized at the socket level.
142Except as noted, each may be examined with
143.Fn getsockopt
144and set with
145.Fn setsockopt .
146.Bl -column SO_ACCEPTFILTER -offset indent

--- 128 unchanged lines hidden (view full) ---

275or the requested amount.
276Receive calls may still return less than the low water mark if an error
277occurs, a signal is caught, or the type of data next in the receive queue
278is different from that which was returned.
279.Pp
280.Dv SO_SNDTIMEO
281is an option to set a timeout value for output operations.
282It accepts a
280.Fa struct timeval
281parameter with the number of seconds and microseconds
283.Vt "struct timeval"
284argument with the number of seconds and microseconds
282used to limit waits for output operations to complete.
283If a send operation has blocked for this much time,
284it returns with a partial count
285or with the error
286.Er EWOULDBLOCK
287if no data were sent.
288In the current implementation, this timer is restarted each time additional
289data are delivered to the protocol,
290implying that the limit applies to output portions ranging in size
291from the low water mark to the high water mark for output.
292.Dv SO_RCVTIMEO
293is an option to set a timeout value for input operations.
294It accepts a
285used to limit waits for output operations to complete.
286If a send operation has blocked for this much time,
287it returns with a partial count
288or with the error
289.Er EWOULDBLOCK
290if no data were sent.
291In the current implementation, this timer is restarted each time additional
292data are delivered to the protocol,
293implying that the limit applies to output portions ranging in size
294from the low water mark to the high water mark for output.
295.Dv SO_RCVTIMEO
296is an option to set a timeout value for input operations.
297It accepts a
295.Fa struct timeval
296parameter with the number of seconds and microseconds
298.Vt "struct timeval"
299argument with the number of seconds and microseconds
297used to limit waits for input operations to complete.
298In the current implementation, this timer is restarted each time additional
299data are received by the protocol,
300and thus the limit is in effect an inactivity timer.
301If a receive operation has been blocked for this much time without
302receiving additional data, it returns with a short count
303or with the error
304.Er EWOULDBLOCK

--- 15 unchanged lines hidden (view full) ---

320system call will fail.
321.Bd -literal
322struct accept_filter_arg {
323 char af_name[16];
324 char af_arg[256-16];
325};
326.Ed
327.Pp
300used to limit waits for input operations to complete.
301In the current implementation, this timer is restarted each time additional
302data are received by the protocol,
303and thus the limit is in effect an inactivity timer.
304If a receive operation has been blocked for this much time without
305receiving additional data, it returns with a short count
306or with the error
307.Er EWOULDBLOCK

--- 15 unchanged lines hidden (view full) ---

323system call will fail.
324.Bd -literal
325struct accept_filter_arg {
326 char af_name[16];
327 char af_arg[256-16];
328};
329.Ed
330.Pp
331The
328.Fa optval
332.Fa optval
333argument
329should point to a
330.Fa struct accept_filter_arg
331that will select and configure the
332.Xr accept_filter 9 .
334should point to a
335.Fa struct accept_filter_arg
336that will select and configure the
337.Xr accept_filter 9 .
338The
333.Fa af_name
339.Fa af_name
340argument
334should be filled with the name of the accept filter
335that the application wishes to place on the listening socket.
341should be filled with the name of the accept filter
342that the application wishes to place on the listening socket.
343The optional argument
336.Fa af_arg
344.Fa af_arg
337is an optional parameter that can be passed to the accept
345can be passed to the accept
338filter specified by
339.Fa af_name
340to provide additional configuration options at attach time.
341Passing in an
342.Fa optval
343of NULL will remove the filter.
344.Pp
345Finally,

--- 58 unchanged lines hidden ---
346filter specified by
347.Fa af_name
348to provide additional configuration options at attach time.
349Passing in an
350.Fa optval
351of NULL will remove the filter.
352.Pp
353Finally,

--- 58 unchanged lines hidden ---