Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys add a crcmp() function.



details:   https://anonhg.NetBSD.org/src/rev/c9c870191269
branches:  trunk
changeset: 547275:c9c870191269
user:      christos <christos%NetBSD.org@localhost>
date:      Fri May 16 13:55:18 2003 +0000

description:
add a crcmp() function.

diffstat:

 sys/kern/kern_prot.c |  16 ++++++++++++++--
 sys/sys/ucred.h      |   3 ++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diffs (54 lines):

diff -r e7cbd78738c4 -r c9c870191269 sys/kern/kern_prot.c
--- a/sys/kern/kern_prot.c      Fri May 16 13:32:15 2003 +0000
+++ b/sys/kern/kern_prot.c      Fri May 16 13:55:18 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_prot.c,v 1.78 2003/03/27 17:47:45 jdolecek Exp $  */
+/*     $NetBSD: kern_prot.c,v 1.79 2003/05/16 13:55:18 christos Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_prot.c,v 1.78 2003/03/27 17:47:45 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_prot.c,v 1.79 2003/05/16 13:55:18 christos Exp $");
 
 #include "opt_compat_43.h"
 
@@ -639,6 +639,18 @@
 }
 
 /*
+ * Compare cred structures and return 0 if they match
+ */
+int
+crcmp(const struct ucred *cr1, const struct uucred *cr2)
+{
+       return cr1->cr_uid != cr2->cr_uid ||
+           cr1->cr_gid != cr2->cr_gid ||
+           cr1->cr_ngroups != (uint32_t)cr2->cr_ngroups ||
+           memcmp(cr1->cr_groups, cr2->cr_groups, cr1->cr_ngroups);
+}
+
+/*
  * Copy cred structure to a new one and free the old one.
  */
 struct ucred *
diff -r e7cbd78738c4 -r c9c870191269 sys/sys/ucred.h
--- a/sys/sys/ucred.h   Fri May 16 13:32:15 2003 +0000
+++ b/sys/sys/ucred.h   Fri May 16 13:55:18 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ucred.h,v 1.16 2003/03/05 18:39:17 dsl Exp $   */
+/*     $NetBSD: ucred.h,v 1.17 2003/05/16 13:55:54 christos Exp $      */
 
 /*
  * Copyright (c) 1989, 1993
@@ -85,6 +85,7 @@
 struct ucred   *crget(void);
 int            suser(const struct ucred *, u_short *);
 void           crcvt(struct ucred *, const struct uucred *);
+int            crcmp(const struct ucred *, const struct uucred *);
 #endif /* _KERNEL */
 
 #endif /* !_SYS_UCRED_H_ */



Home | Main Index | Thread Index | Old Index