In message <91ebf9d8-5547-8570-18cb-26a58baf8...@freebsd.org>, John Baldwin 
wri
tes:
> On 10/19/21 1:35 PM, Cy Schubert wrote:
> > In message <202110192004.19jk4jn3069...@gitrepo.freebsd.org>, Konstantin
> > Belous
> > ov writes:
> >> The branch main has been updated by kib:
> >>
> >> URL: https://cgit.FreeBSD.org/src/commit/?id=7ae879b14a2086df521c59c4a379d
> 3a0
> >> 72e08bc6
> >>
> >> commit 7ae879b14a2086df521c59c4a379d3a072e08bc6
> >> Author:     Konstantin Belousov <k...@freebsd.org>
> >> AuthorDate: 2021-10-15 18:57:17 +0000
> >> Commit:     Konstantin Belousov <k...@freebsd.org>
> >> CommitDate: 2021-10-19 20:04:34 +0000
> >>
> >>      kern_procctl(): convert the function to be table-driven
> >>      
> >>      Reviewed by:    emaste, markj
> >>      Sponsored by:   The FreeBSD Foundation
> >>      MFC after:      1 week
> >>      Differential revision:  https://reviews.freebsd.org/D32513
> >> ---
> >>   sys/kern/kern_procctl.c | 123 +++++++++++++++++++++++++++---------------
> ----
> >> --
> >>   1 file changed, 69 insertions(+), 54 deletions(-)
> >>
> >> diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c
> >> index eb36f0822938..90c5e63c7219 100644
> >> --- a/sys/kern/kern_procctl.c
> >> +++ b/sys/kern/kern_procctl.c
> >> @@ -949,7 +957,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t
>  id
> >> , int com, void *data)
> >>            error = EINVAL;
> >>            break;
> >>    }
> >> -  if (tree_locked)
> >> -          sx_unlock(&proctree_lock);
> >> +
> >> +  switch (cmd_info->lock_tree) {
> >> +  case SA_XLOCKED:
> >> +          sx_xunlock(&proctree_lock);
> >> +          break;
> >> +  case SA_SLOCKED:
> >> +          sx_sunlock(&proctree_lock);
> >> +          break;
> >> +  }
> >>    return (error);
> >>   }
> >>
> > 
> > Should SA_* in fact be LA_*? SA_* in sys/sx.h assumes INVARIANTS whereas
> > LA_* in sys/lock.h has no such requirement.
>
> Both are for "assertions".  The LA_* constants aren't really public but are
> the values used for witness_assert() that various foo_assert() routines in
> locking APIs (mtx_assert/sx_assert, etc.) can use.  For locking APIs, the
> type-specific macros are the ones you use, e.g. SA_* with sx_assert().
>
> Given that, SA_* is the closest match here.

We'll need some #ifdefs for non-INVARIANTS built kernels, as it stands 
buildkernel is broken.


-- 
Cheers,
Cy Schubert <cy.schub...@cschubert.com>
FreeBSD UNIX:  <c...@freebsd.org>   Web:  https://FreeBSD.org
NTP:           <c...@nwtime.org>    Web:  https://nwtime.org

        The need of the many outweighs the greed of the few.



Reply via email to