Re: [RFC] An idea for general kernel post-processing automation in FreeBSD

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Sun, 21 May 2023 22:18:14 UTC
On 5/21/23 23:24, Mark Millard wrote:
> DEFINE_MUTEX is defined in:
> 
> # grep -r "define.*DEFINE_MUTEX"/usr/main-src/sys/  | more
> /usr/main-src/sys/compat/linuxkpi/common/include/linux/mutex.h:#define  DEFINE_MUTEX(lock)

Hi Mark,

The mutex structure declared is still "static" and local to the C-file. 
There is no issue.

If we could have a SX_STATIC_INIT() macro in FreeBSD, this would be a 
better solution, and would also save the crunch associated by SYSINITs. 
The LinuxKPI does not use Witness on these locks, because Linux has a 
bad habit of not destroying them, so FreeBSD Witness objects would leak 
and cause other problems when modules are reloaded for example. If 
witness is not needed, there is little use from sx_init(). It almost 
does nothing.

--HPS