Module Name:    src
Committed By:   kamil
Date:           Sat Feb  1 18:14:16 UTC 2020

Modified Files:
        src/lib/libc/gen: pthread_atfork.c
        src/lib/libpthread: pthread_mutex.c

Log Message:
Revert previous

'git grep' breaks now.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/gen/pthread_atfork.c
cvs rdiff -u -r1.73 -r1.74 src/lib/libpthread/pthread_mutex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/pthread_atfork.c
diff -u src/lib/libc/gen/pthread_atfork.c:1.11 src/lib/libc/gen/pthread_atfork.c:1.12
--- src/lib/libc/gen/pthread_atfork.c:1.11	Sat Feb  1 15:38:46 2020
+++ src/lib/libc/gen/pthread_atfork.c	Sat Feb  1 18:14:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_atfork.c,v 1.11 2020/02/01 15:38:46 kamil Exp $	*/
+/*	$NetBSD: pthread_atfork.c,v 1.12 2020/02/01 18:14:16 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,17 +31,15 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: pthread_atfork.c,v 1.11 2020/02/01 15:38:46 kamil Exp $");
+__RCSID("$NetBSD: pthread_atfork.c,v 1.12 2020/02/01 18:14:16 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/queue.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <sys/queue.h>
 #include "reentrant.h"
 
 #ifdef __weak_alias
@@ -75,22 +73,11 @@ static struct atfork_callback_q childq =
 static struct atfork_callback *
 af_alloc(void)
 {
-	void *arena;
-	size_t sz;
 
 	if (atfork_builtin.fn == NULL)
 		return &atfork_builtin;
 
-	/*
-	 * Avoid using here malloc() as this function is used on early init
-	 * and can prematuraly initialize the malloc library.
-	 * malloc() allocations here also confuse the LLVM Leak Sanitizer.
-	 */
-	sz = sizeof(atfork_builtin);
-	arena = mmap(NULL, sz, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0);
-	if (arena == MAP_FAILED)
-		return NULL;
-	return arena;
+	return malloc(sizeof(atfork_builtin));
 }
 
 static void
@@ -98,7 +85,7 @@ af_free(struct atfork_callback *af)
 {
 
 	if (af != &atfork_builtin)
-		munmap(af, sizeof(atfork_builtin));
+		free(af);
 }
 
 int

Index: src/lib/libpthread/pthread_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.73 src/lib/libpthread/pthread_mutex.c:1.74
--- src/lib/libpthread/pthread_mutex.c:1.73	Sat Feb  1 15:39:56 2020
+++ src/lib/libpthread/pthread_mutex.c	Sat Feb  1 18:14:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.73 2020/02/01 15:39:56 kamil Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.74 2020/02/01 18:14:16 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_mutex.c,v 1.73 2020/02/01 15:39:56 kamil Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.74 2020/02/01 18:14:16 kamil Exp $");
 
 #include <sys/types.h>
 #include <sys/lwpctl.h>
@@ -122,12 +122,14 @@ pthread_mutex_init(pthread_mutex_t *ptm,
 {
 	uintptr_t type, proto, val, ceil;
 
+#if 0
 	/*
 	 * Always initialize the mutex structure, maybe be used later
 	 * and the cost should be minimal.
 	 */
 	if (__predict_false(__uselibcstub))
 		return __libc_mutex_init_stub(ptm, attr);
+#endif
 
 	pthread__error(EINVAL, "Invalid mutes attribute",
 	    attr == NULL || attr->ptma_magic == _PT_MUTEXATTR_MAGIC);
@@ -617,9 +619,10 @@ pthread__mutex_wakeup(pthread_t self, pt
 int
 pthread_mutexattr_init(pthread_mutexattr_t *attr)
 {
-
+#if 0
 	if (__predict_false(__uselibcstub))
 		return __libc_mutexattr_init_stub(attr);
+#endif
 
 	attr->ptma_magic = _PT_MUTEXATTR_MAGIC;
 	attr->ptma_private = (void *)PTHREAD_MUTEX_DEFAULT;

Reply via email to