Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Apr 2017 19:37:45 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317611 - head/lib/libc/gen
Message-ID:  <201704301937.v3UJbjGE029818@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun Apr 30 19:37:45 2017
New Revision: 317611
URL: https://svnweb.freebsd.org/changeset/base/317611

Log:
  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

Modified:
  head/lib/libc/gen/sem_new.c

Modified: head/lib/libc/gen/sem_new.c
==============================================================================
--- head/lib/libc/gen/sem_new.c	Sun Apr 30 19:32:51 2017	(r317610)
+++ head/lib/libc/gen/sem_new.c	Sun Apr 30 19:37:45 2017	(r317611)
@@ -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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704301937.v3UJbjGE029818>