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);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to