Annotation of cci/usr/src/man/man2/getsockopt.2, revision 1.1.1.1

1.1       root        1: .TH GETSOCKOPT 2 "7 July 1983"
                      2: .UC 4
                      3: .SH NAME
                      4: getsockopt, setsockopt \- get and set options on sockets
                      5: .SH SYNOPSIS
                      6: .nf
                      7: .ft B
                      8: #include <sys/types.h>
                      9: #include <sys/socket.h>
                     10: .PP
                     11: .ft B
                     12: getsockopt(s, level, optname, optval, optlen)
                     13: int s, level, optname;
                     14: char *optval;
                     15: int *optlen;
                     16: .sp
                     17: setsockopt(s, level, optname, optval, optlen)
                     18: int s, level, optname;
                     19: char *optval;
                     20: int optlen;
                     21: .fi
                     22: .SH DESCRIPTION
                     23: .I Getsockopt
                     24: and
                     25: .I setsockopt
                     26: manipulate
                     27: .I options
                     28: associated with a socket.  Options may exist at multiple
                     29: protocol levels; they are always present at the uppermost
                     30: ``socket'' level.
                     31: .PP
                     32: When manipulating socket options the level at which the
                     33: option resides and the name of the option must be specified.
                     34: To manipulate options at the ``socket'' level,
                     35: .I level
                     36: is specified as SOL_SOCKET.  To manipulate options at any
                     37: other level the protocol number of the appropriate protocol
                     38: controlling the option is supplied.  For example,
                     39: to indicate an option is to be interpreted by the TCP protocol,
                     40: .I level
                     41: should be set to the protocol number of TCP; see
                     42: .IR getprotoent (3N).
                     43: .PP
                     44: The parameters
                     45: .I optval
                     46: and
                     47: .I optlen
                     48: are used to access option values for
                     49: .IR setsockopt .
                     50: For
                     51: .I getsockopt
                     52: they identify a buffer in which the value for the
                     53: requested option(s) are to be returned.  For
                     54: .IR getsockopt ,
                     55: .I optlen
                     56: is a value-result parameter, initially containing the
                     57: size of the buffer pointed to by
                     58: .IR optval ,
                     59: and modified on return to indicate the actual size of
                     60: the value returned.  If no option value is
                     61: to be supplied or returned,
                     62: .I optval
                     63: may be supplied as 0.
                     64: .PP
                     65: .I Optname
                     66: and any specified options are passed uninterpreted to the appropriate
                     67: protocol module for interpretation.
                     68: The include file
                     69: .RI < sys/socket.h >
                     70: contains definitions for ``socket'' level options; see
                     71: .IR socket (2).
                     72: Options at other protocol levels vary in format and
                     73: name, consult the appropriate entries in (4P).  
                     74: .SH "RETURN VALUE"
                     75: A 0 is returned if the call succeeds, \-1 if it fails.
                     76: .SH ERRORS
                     77: The call succeeds unless:
                     78: .TP 20
                     79: [EBADF]
                     80: The argument \fIs\fP is not a valid descriptor.
                     81: .TP 20
                     82: [ENOTSOCK]
                     83: The argument \fIs\fP is a file, not a socket.
                     84: .TP 20
                     85: [ENOPROTOOPT]
                     86: The option is unknown.
                     87: .TP 20
                     88: [EFAULT]
                     89: The options are not in a valid part of the
                     90: process address space.
                     91: .SH "SEE ALSO"
                     92: socket(2), getprotoent(3N)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.