From: mvs Date: Wed, 7 Dec 2022 20:08:28 +0000 (+0000) Subject: Document 'uidinfo' structure locks. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=14f56bace831554237926ab8665bb85097417bd1;p=openbsd Document 'uidinfo' structure locks. Inputs and ok bluhm@ --- diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 932b53b73ac..e68ffad4126 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_proc.c,v 1.92 2022/08/14 01:58:27 jsg Exp $ */ +/* $OpenBSD: kern_proc.c,v 1.93 2022/12/07 20:08:28 mvs Exp $ */ /* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */ /* @@ -43,10 +43,16 @@ #include #include +/* + * Locks used to protect struct members in this file: + * I immutable after creation + * U uidinfolk + */ + struct rwlock uidinfolk; #define UIHASH(uid) (&uihashtbl[(uid) & uihash]) -LIST_HEAD(uihashhead, uidinfo) *uihashtbl; -u_long uihash; /* size of hash table - 1 */ +LIST_HEAD(uihashhead, uidinfo) *uihashtbl; /* [U] */ +u_long uihash; /* [I] size of hash table - 1 */ /* * Other process lists diff --git a/sys/sys/proc.h b/sys/sys/proc.h index b4585103f31..a916b1d4566 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.335 2022/11/23 11:00:27 mbuhl Exp $ */ +/* $OpenBSD: proc.h,v 1.336 2022/12/07 20:08:29 mvs Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -303,6 +303,7 @@ struct p_inentry { * Locks used to protect struct members in this file: * I immutable after creation * S scheduler lock + * U uidinfolk * l read only reference, see lim_read_enter() * o owned (read/modified only) by this thread */ @@ -433,10 +434,10 @@ struct proc { #ifdef _KERNEL struct uidinfo { - LIST_ENTRY(uidinfo) ui_hash; - uid_t ui_uid; - long ui_proccnt; /* proc structs */ - long ui_lockcnt; /* lockf structs */ + LIST_ENTRY(uidinfo) ui_hash; /* [U] */ + uid_t ui_uid; /* [I] */ + long ui_proccnt; /* [U] proc structs */ + long ui_lockcnt; /* [U] lockf structs */ }; struct uidinfo *uid_find(uid_t);