1*e2caf0e7SMatthew Dillon /*
2*e2caf0e7SMatthew Dillon * Copyright (c) 2017 The DragonFly Project. All rights reserved.
3*e2caf0e7SMatthew Dillon *
4*e2caf0e7SMatthew Dillon * This code is derived from software contributed to The DragonFly Project
5*e2caf0e7SMatthew Dillon * by Matthew Dillon <dillon@backplane.com>
6*e2caf0e7SMatthew Dillon *
7*e2caf0e7SMatthew Dillon * Redistribution and use in source and binary forms, with or without
8*e2caf0e7SMatthew Dillon * modification, are permitted provided that the following conditions
9*e2caf0e7SMatthew Dillon * are met:
10*e2caf0e7SMatthew Dillon *
11*e2caf0e7SMatthew Dillon * 1. Redistributions of source code must retain the above copyright
12*e2caf0e7SMatthew Dillon * notice, this list of conditions and the following disclaimer.
13*e2caf0e7SMatthew Dillon * 2. Redistributions in binary form must reproduce the above copyright
14*e2caf0e7SMatthew Dillon * notice, this list of conditions and the following disclaimer in
15*e2caf0e7SMatthew Dillon * the documentation and/or other materials provided with the
16*e2caf0e7SMatthew Dillon * distribution.
17*e2caf0e7SMatthew Dillon *
18*e2caf0e7SMatthew Dillon * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19*e2caf0e7SMatthew Dillon * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20*e2caf0e7SMatthew Dillon * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21*e2caf0e7SMatthew Dillon * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22*e2caf0e7SMatthew Dillon * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23*e2caf0e7SMatthew Dillon * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
24*e2caf0e7SMatthew Dillon * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25*e2caf0e7SMatthew Dillon * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26*e2caf0e7SMatthew Dillon * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27*e2caf0e7SMatthew Dillon * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
28*e2caf0e7SMatthew Dillon * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29*e2caf0e7SMatthew Dillon * SUCH DAMAGE.
30*e2caf0e7SMatthew Dillon */
31*e2caf0e7SMatthew Dillon
32*e2caf0e7SMatthew Dillon #include "libc_private.h"
33*e2caf0e7SMatthew Dillon #include "namespace.h"
34*e2caf0e7SMatthew Dillon #include <machine/tls.h>
35*e2caf0e7SMatthew Dillon #include <stdlib.h>
36*e2caf0e7SMatthew Dillon #include <string.h>
37*e2caf0e7SMatthew Dillon #include <pthread.h>
38*e2caf0e7SMatthew Dillon
39*e2caf0e7SMatthew Dillon #include "un-namespace.h"
40*e2caf0e7SMatthew Dillon #include "rtld_lock.h"
41*e2caf0e7SMatthew Dillon #include "thr_private.h"
42*e2caf0e7SMatthew Dillon
43*e2caf0e7SMatthew Dillon void
_thr_malloc_init(void)44*e2caf0e7SMatthew Dillon _thr_malloc_init(void)
45*e2caf0e7SMatthew Dillon {
46*e2caf0e7SMatthew Dillon static int once = 0;
47*e2caf0e7SMatthew Dillon
48*e2caf0e7SMatthew Dillon if (once == 0) {
49*e2caf0e7SMatthew Dillon once = 1;
50*e2caf0e7SMatthew Dillon _thr_atfork_kern(_nmalloc_thr_prepfork,
51*e2caf0e7SMatthew Dillon _nmalloc_thr_parentfork,
52*e2caf0e7SMatthew Dillon _nmalloc_thr_childfork);
53*e2caf0e7SMatthew Dillon }
54*e2caf0e7SMatthew Dillon }
55