git: b15110fb0dc6 - main - cred: Constify signature of groupmember() and realgroupmember()

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Sat, 02 Nov 2024 20:39:26 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=b15110fb0dc6f0480482616f22bda3a2a19fbd80

commit b15110fb0dc6f0480482616f22bda3a2a19fbd80
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-10-30 10:59:49 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-11-02 20:37:40 +0000

    cred: Constify signature of groupmember() and realgroupmember()
    
    Reviewed by     emaste
    Approved by:    markj (mentor)
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D47343
---
 share/man/man9/groupmember.9 | 6 +++---
 sys/kern/kern_prot.c         | 4 ++--
 sys/sys/ucred.h              | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/share/man/man9/groupmember.9 b/share/man/man9/groupmember.9
index db2138ef088a..e7e28bae3ac9 100644
--- a/share/man/man9/groupmember.9
+++ b/share/man/man9/groupmember.9
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 .\" DAMAGE.
 .\"
-.Dd August 18, 2023
+.Dd October 31, 2024
 .Dt GROUPMEMBER 9
 .Os
 .Sh NAME
@@ -35,9 +35,9 @@
 .In sys/param.h
 .In sys/ucred.h
 .Ft bool
-.Fn groupmember "gid_t gid" "struct ucred *cred"
+.Fn groupmember "gid_t gid" "const struct ucred *cred"
 .Ft bool
-.Fn realgroupmember "gid_t gid" "struct ucred *cred"
+.Fn realgroupmember "gid_t gid" "const struct ucred *cred"
 .Sh DESCRIPTION
 The
 .Fn groupmember
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 4668bdea3fdd..b2511ce1e6c8 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1307,7 +1307,7 @@ group_is_supplementary(const gid_t gid, const struct ucred *const cred)
  * supplementary groups).
  */
 bool
-groupmember(gid_t gid, struct ucred *cred)
+groupmember(gid_t gid, const struct ucred *cred)
 {
 
 	/*
@@ -1328,7 +1328,7 @@ groupmember(gid_t gid, struct ucred *cred)
  * groups).
  */
 bool
-realgroupmember(gid_t gid, struct ucred *cred)
+realgroupmember(gid_t gid, const struct ucred *cred)
 {
 	if (gid == cred->cr_rgid)
 		return (true);
diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h
index 0d04a49eefb4..ee72af000a58 100644
--- a/sys/sys/ucred.h
+++ b/sys/sys/ucred.h
@@ -155,8 +155,8 @@ void	crcowfree(struct thread *td);
 void	cru2x(struct ucred *cr, struct xucred *xcr);
 void	cru2xt(struct thread *td, struct xucred *xcr);
 void	crsetgroups(struct ucred *cr, int n, gid_t *groups);
-bool	groupmember(gid_t gid, struct ucred *cred);
-bool	realgroupmember(gid_t gid, struct ucred *cred);
+bool	groupmember(gid_t gid, const struct ucred *cred);
+bool	realgroupmember(gid_t gid, const struct ucred *cred);
 #endif /* _KERNEL */
 
 #endif /* !_SYS_UCRED_H_ */