1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

Make semaphore names list mutex non-recursive.

The mutex is used in sem_open() and sem_close(), which cannot
recurse. The atfork handlers cannot collide with the open and close
code.

Reviewed by:	vangyzen
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D10545
This commit is contained in:
Konstantin Belousov 2017-04-30 19:37:45 +00:00
parent e6a183a40e
commit f7a6f6a2c0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317611

View File

@ -104,12 +104,8 @@ sem_child_postfork(void)
static void
sem_module_init(void)
{
pthread_mutexattr_t ma;
_pthread_mutexattr_init(&ma);
_pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE);
_pthread_mutex_init(&sem_llock, &ma);
_pthread_mutexattr_destroy(&ma);
_pthread_mutex_init(&sem_llock, NULL);
_pthread_atfork(sem_prefork, sem_postfork, sem_child_postfork);
}