getsockopt(2)
_________________________________________________________________
getsockopt System Call
Get options on a socket.
_________________________________________________________________
SYNTAX
#include <socket.h>
int getsockopt (s, level, optname, optval, optlen)
int s;
int level;
int optname;
char * optval;
int * optlen;
PARAMETERS
s File descriptor of socket to get options from.
level Level in socket that the options apply to.
optname Name of option to return. Options are defined in
<socket.h>.
optval Buffer to receive options.
optlen On input contains the number of bytes available
for the options; updated to indicate the number of
bytes returned.
DESCRIPTION
Getsockopt retrieves options associated with a socket. Options
may exist at multiple protocol levels; they are always present at
the uppermost socket level.
When getting socket options, the caller must specify the level at
which the option resides and the name of the option. To retrieve
options at the socket level, <level> is specified as SOL_SOCKET.
To get options at any other level, the protocol number of the
appropriate protocol controlling the option is supplied. Consult
domain specific documentation for more information related to a
specific protocol.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
getsockopt(2)
The parameters <optval> and <optlen> identify a buffer in which
the value for the requested option(s) are to be returned.
<optlen> is a value/result parameter, initially containing the
size of the buffer pointed to by <optval>, and modified on return
to indicate the actual size of the value returned. If no option
value is to be returned, <optval> may be supplied as 0. If the
buffer isn't large enough for the options, they will be
truncated.
<Optname> and any specified options are passed uninterpreted to
the appropriate protocol module for interpretation. The include
file <sys/socket.h> contains definitions for socket level
options; see socket. Options at other protocol levels vary in
format and name; consult the related documentation for the domain
of the socket.
ACCESS CONTROL
SOL_SOCKET has no access restrictions. (See domain-specific
documentation for any domain restrictions.)
RETURN VALUE
0 Completed successfully.
-1 An error occurred. Errno is set to indicate the
error.
EXCEPTIONS
Errno may be set to one of the following error codes:
EBADF The argument <s> is not an active valid
descriptor.
ENOTSOCK The argument <s> is not a file of type S_IFSOCK
(socket special).
ENOPROTOOPT The option is unknown.
EFAULT The <optval> is not in a valid part of the process
address space, or <optlen> < 0.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
getsockopt(2)
ENOBUFS No internal buffers available.
SEE ALSO
The related manual sections: inet(3N), inet(6F), unix_ipc(6F),
setsockopt(2), socket(2).
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)