svn commit: r364074 - in stable/12: lib/libc/gen share/man/man4 sys/kern sys/sys
Konstantin Belousov
kib at FreeBSD.org
Mon Aug 10 10:52:55 UTC 2020
Author: kib
Date: Mon Aug 10 10:52:54 2020
New Revision: 364074
URL: https://svnweb.freebsd.org/changeset/base/364074
Log:
MFC r363813:
Add SOL_LOCAL symbolic constant for unix socket option level.
Modified:
stable/12/lib/libc/gen/getpeereid.c
stable/12/share/man/man4/unix.4
stable/12/sys/kern/uipc_usrreq.c
stable/12/sys/sys/un.h
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/lib/libc/gen/getpeereid.c
==============================================================================
--- stable/12/lib/libc/gen/getpeereid.c Mon Aug 10 10:46:08 2020 (r364073)
+++ stable/12/lib/libc/gen/getpeereid.c Mon Aug 10 10:52:54 2020 (r364074)
@@ -47,7 +47,7 @@ getpeereid(int s, uid_t *euid, gid_t *egid)
int error;
xuclen = sizeof(xuc);
- error = _getsockopt(s, 0, LOCAL_PEERCRED, &xuc, &xuclen);
+ error = _getsockopt(s, SOL_LOCAL, LOCAL_PEERCRED, &xuc, &xuclen);
if (error != 0)
return (error);
if (xuc.cr_version != XUCRED_VERSION) {
Modified: stable/12/share/man/man4/unix.4
==============================================================================
--- stable/12/share/man/man4/unix.4 Mon Aug 10 10:46:08 2020 (r364073)
+++ stable/12/share/man/man4/unix.4 Mon Aug 10 10:52:54 2020 (r364074)
@@ -28,7 +28,7 @@
.\" @(#)unix.4 8.1 (Berkeley) 6/9/93
.\" $FreeBSD$
.\"
-.Dd August 19, 2018
+.Dd August 3, 2020
.Dt UNIX 4
.Os
.Sh NAME
@@ -195,7 +195,9 @@ The sending process could have exited and its process
reused for a new process.
.Sh SOCKET OPTIONS
.Tn UNIX
-domain sockets support a number of socket options which can be set with
+domain sockets support a number of socket options for the options level
+.Dv SOL_LOCAL ,
+which can be set with
.Xr setsockopt 2
and tested with
.Xr getsockopt 2 :
Modified: stable/12/sys/kern/uipc_usrreq.c
==============================================================================
--- stable/12/sys/kern/uipc_usrreq.c Mon Aug 10 10:46:08 2020 (r364073)
+++ stable/12/sys/kern/uipc_usrreq.c Mon Aug 10 10:52:54 2020 (r364074)
@@ -1467,7 +1467,7 @@ uipc_ctloutput(struct socket *so, struct sockopt *sopt
struct xucred xu;
int error, optval;
- if (sopt->sopt_level != 0)
+ if (sopt->sopt_level != SOL_LOCAL)
return (EINVAL);
unp = sotounpcb(so);
Modified: stable/12/sys/sys/un.h
==============================================================================
--- stable/12/sys/sys/un.h Mon Aug 10 10:46:08 2020 (r364073)
+++ stable/12/sys/sys/un.h Mon Aug 10 10:52:54 2020 (r364074)
@@ -54,6 +54,8 @@ struct sockaddr_un {
#if __BSD_VISIBLE
+#define SOL_LOCAL 0 /* Options for local socket */
+
/* Socket options. */
#define LOCAL_PEERCRED 1 /* retrieve peer credentials */
#define LOCAL_CREDS 2 /* pass credentials to receiver */
More information about the svn-src-stable
mailing list