summaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorkamil <kamil@NetBSD.org>2020-02-01 18:14:16 +0000
committerkamil <kamil@NetBSD.org>2020-02-01 18:14:16 +0000
commit32daece6bcac21ef3c8d9326fa4eab80d35affba (patch)
tree319fc6b53f5ce3c0d354d338e05d4fbd4ae0fe4d /lib/libc/gen
parent296cac0517b738674adfd124ee577daa7d2ccc66 (diff)
Revert previous
'git grep' breaks now.
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/pthread_atfork.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/lib/libc/gen/pthread_atfork.c b/lib/libc/gen/pthread_atfork.c
index e983552683b..bfa08bf9e2d 100644
--- a/lib/libc/gen/pthread_atfork.c
+++ b/lib/libc/gen/pthread_atfork.c
@@ -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 = SIMPLEQ_HEAD_INITIALIZER(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