-.\" $OpenBSD: getsockopt.2,v 1.57 2021/02/04 18:51:01 bluhm Exp $
+.\" $OpenBSD: getsockopt.2,v 1.58 2021/10/08 14:12:58 jmc Exp $
.\" $NetBSD: getsockopt.2,v 1.7 1995/02/27 12:33:29 cgd Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\"
.\" @(#)getsockopt.2 8.3 (Berkeley) 4/19/94
.\"
-.Dd $Mdocdate: February 4 2021 $
+.Dd $Mdocdate: October 8 2021 $
.Dt GETSOCKOPT 2
.Os
.Sh NAME
set timeout value for input
.It Dv SO_TIMESTAMP
enables reception of a timestamp with datagrams
-.It Dv SO_PEERCRED
-get the credentials from other side of connection
.It Dv SO_RTABLE
set the routing table used for route lookups
.It Dv SO_SPLICE
get the domain of the socket (get only)
.It Dv SO_PROTOCOL
get the protocol of the socket (get only)
+.It Dv SO_PEERCRED
+get the credentials from other side of connection (get only)
.El
.Pp
.Dv SO_DEBUG
cmsg_type = SCM_TIMESTAMP
.Ed
.Pp
-.Dv SO_PEERCRED
-fetches the
-.Va struct sockpeercred
-credentials from the other side of the connection
-(currently only possible on
-.Dv AF_UNIX
-sockets).
-These credentials are from the time that
-.Xr bind 2 ,
-.Xr connect 2
-or
-.Xr socketpair 2
-were called.
-.Pp
The
.Dv SO_RTABLE
option gets or sets the routing table which will be used by the socket
Finally,
.Dv SO_TYPE ,
.Dv SO_DOMAIN ,
-.Dv SO_PROTOCOL
+.Dv SO_PROTOCOL ,
+.Dv SO_ERROR ,
and
-.Dv SO_ERROR
+.Dv SO_PEERCRED
are options used only with
.Fn getsockopt .
.Dv SO_TYPE
returns any pending error on the socket and clears the error status.
It may be used to check for asynchronous errors on connected
datagram sockets or for other asynchronous errors.
+.Dv SO_PEERCRED
+fetches the
+.Va struct sockpeercred
+credentials from the other side of the connection
+(currently only possible on
+.Dv AF_UNIX
+sockets).
+These credentials are from the time that
+.Xr bind 2 ,
+.Xr connect 2
+or
+.Xr socketpair 2
+were called.
.Sh RETURN VALUES
.Rv -std
.Sh ERRORS