My next issue in the NetBSD build is about mutexes. I gather this is very much about openssl 1.1, and all of this is only about non-Linux since there futexes are used. (pkgsrc has switched to openssl 1.1 basically the beginning of 2020.)
I am guessing that the basic issue is that the pthread mutexes are placed in shared memory and used from multiple processes, and that regardless of setting attributes, the point is that these need to work in that environment, and if not, some other synchronization scheme needs to be chosen. And, I gather the problem is lack of a wakeup on release to blocked threads in other processes. Close?
There is -DKSR_PTHREAD_MUTEX_SHARED defined:
ifeq ($(LIBSSL_SET_MUTEX_SHARED), 1) CC_PMUTEX_OPTS = -pthread -DKSR_PTHREAD_MUTEX_SHARED LD_PMUTEX_OPTS = -pthread -rdynamic -Wl,-Bsymbolic-functions else CC_PMUTEX_OPTS = LD_PMUTEX_OPTS = endif
and this seems to get turned on regardless of which mutex option an OS uses.
Later, in the netbsd if chunk
ifneq ($(found_lock_method), yes) C_DEFS+= -DUSE_SYSV_SEM # try pthread sems found_lock_method=yes
but then -DKSR_PTHREAD_MUTEX_SHARED is still on, and the code that usss pthread_mutexattr_setpshared is compiled in. I am thinking it might not be used, because of SYSV_SEM.
(Btw, the check for NetBSD > 2.0.0 and kqueue can be removed; we support only 8 and 9 now, and while I don't like to gratuitously desupport older versions, I really doubt current kamailo would build on anything earlier than 6 anyway. Similar for FreeBSD probably, but I don't want to speak for them.)
Thanks, Greg