Download raw body.
sysctl: unlock KERN_CONSBUF and KERN_MSGBUF
I agree. The memory operations upon the object should be adjacent, and there should be no external call between them. mtx_enter() is (potentially?) an external call in the global scope. If the memory operation are adjacent, a compiler can decide upon the order of writes and avoid extras, because memset is known to the compiler. > Index: kern/kern_sysctl.c > =================================================================== > RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_sysctl.c,v > diff -u -p -r1.467 kern_sysctl.c > --- kern/kern_sysctl.c 6 May 2025 18:34:26 -0000 1.467 > +++ kern/kern_sysctl.c 8 May 2025 12:58:42 -0000 > @@ -598,8 +598,8 @@ kern_sysctl(int *name, u_int namelen, vo > } else > return (0); > > - memset(&ump, 0, sizeof(ump)); > mtx_enter(&log_mtx); > + memset(&ump, 0, sizeof(ump)); > ump.msg_magic = mp->msg_magic; > ump.msg_bufs = mp->msg_bufs; > ump.msg_bufx = mp->msg_bufx; >
sysctl: unlock KERN_CONSBUF and KERN_MSGBUF