Skip to content

Commit 14133f7

Browse files
committed
Revert for now. There has been a report that arc4random breaks with it,
and the tests for arc4random set RLIMIT_AS to 0 so that mmap fails.
1 parent 4a89802 commit 14133f7

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

lib/libc/gen/pthread_atfork.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: pthread_atfork.c,v 1.20 2025/02/28 23:59:55 kre Exp $ */
1+
/* $NetBSD: pthread_atfork.c,v 1.21 2025/03/01 16:34:03 christos Exp $ */
22

33
/*-
44
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,17 +31,15 @@
3131

3232
#include <sys/cdefs.h>
3333
#if defined(LIBC_SCCS) && !defined(lint)
34-
__RCSID("$NetBSD: pthread_atfork.c,v 1.20 2025/02/28 23:59:55 kre Exp $");
34+
__RCSID("$NetBSD: pthread_atfork.c,v 1.21 2025/03/01 16:34:03 christos Exp $");
3535
#endif /* LIBC_SCCS and not lint */
3636

3737
#include "namespace.h"
3838

39-
#include <sys/queue.h>
40-
#include <sys/mman.h>
4139
#include <errno.h>
4240
#include <stdlib.h>
4341
#include <unistd.h>
44-
42+
#include <sys/queue.h>
4543
#include "extern.h"
4644
#include "reentrant.h"
4745

@@ -80,22 +78,19 @@ static struct atfork_callback_q childq = SIMPLEQ_HEAD_INITIALIZER(childq);
8078
static struct atfork_callback *
8179
af_alloc(void)
8280
{
83-
void *rv;
8481

8582
if (atfork_builtin.fn == NULL)
8683
return &atfork_builtin;
8784

88-
rv = mmap(0, sizeof(atfork_builtin), PROT_READ|PROT_WRITE,
89-
MAP_PRIVATE | MAP_ANON, -1, 0);
90-
return rv == MAP_FAILED ? NULL : rv;
85+
return malloc(sizeof(atfork_builtin));
9186
}
9287

9388
static void
9489
af_free(struct atfork_callback *af)
9590
{
9691

9792
if (af != &atfork_builtin)
98-
munmap(af, sizeof(*af));
93+
free(af);
9994
}
10095

10196
int

0 commit comments

Comments
 (0)