svn commit: r363813 - in head: lib/libc/gen share/man/man4 sys/kern sys/sys
Konstantin Belousov
kib at FreeBSD.org
Mon Aug 3 22:13:04 UTC 2020
Author: kib
Date: Mon Aug 3 22:13:02 2020
New Revision: 363813
URL: https://svnweb.freebsd.org/changeset/base/363813
Log:
Add SOL_LOCAL symbolic constant for unix socket option level.
The constant seems to exists on MacOS X >= 10.8.
Requested by: swills
Reviewed by: allanjude, kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25933
Modified:
head/lib/libc/gen/getpeereid.c
head/share/man/man4/unix.4
head/sys/kern/uipc_usrreq.c
head/sys/sys/un.h
Modified: head/lib/libc/gen/getpeereid.c
==============================================================================
--- head/lib/libc/gen/getpeereid.c Mon Aug 3 22:12:18 2020 (r363812)
+++ head/lib/libc/gen/getpeereid.c Mon Aug 3 22:13:02 2020 (r363813)
@@ -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: head/share/man/man4/unix.4
==============================================================================
--- head/share/man/man4/unix.4 Mon Aug 3 22:12:18 2020 (r363812)
+++ head/share/man/man4/unix.4 Mon Aug 3 22:13:02 2020 (r363813)
@@ -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: head/sys/kern/uipc_usrreq.c
==============================================================================
--- head/sys/kern/uipc_usrreq.c Mon Aug 3 22:12:18 2020 (r363812)
+++ head/sys/kern/uipc_usrreq.c Mon Aug 3 22:13:02 2020 (r363813)
@@ -1470,7 +1470,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: head/sys/sys/un.h
==============================================================================
--- head/sys/sys/un.h Mon Aug 3 22:12:18 2020 (r363812)
+++ head/sys/sys/un.h Mon Aug 3 22:13:02 2020 (r363813)
@@ -62,6 +62,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-head
mailing list