4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
32 #include <umem_impl.h>
40 extern size_t pagesize
;
42 #define PAGESIZE pagesize
45 * umem.c: non-tunables
47 extern vmem_t
*umem_memalign_arena
;
49 extern int umem_ready
;
50 extern thread_t umem_init_thr
; /* the thread doing the init */
52 extern int umem_init(void); /* do umem's initialization */
53 #pragma rarely_called(umem_init)
55 extern umem_log_header_t
*umem_transaction_log
;
56 extern umem_log_header_t
*umem_content_log
;
57 extern umem_log_header_t
*umem_failure_log
;
58 extern umem_log_header_t
*umem_slab_log
;
60 extern mutex_t umem_init_lock
;
62 extern mutex_t umem_cache_lock
;
63 extern umem_cache_t umem_null_cache
;
65 extern mutex_t umem_flags_lock
;
67 extern mutex_t umem_update_lock
;
68 extern cond_t umem_update_cv
;
69 extern volatile thread_t umem_st_update_thr
;
70 extern thread_t umem_update_thr
;
71 extern struct timeval umem_update_next
;
73 extern volatile hrtime_t umem_reap_next
;
74 extern volatile uint32_t umem_reaping
;
75 #define UMEM_REAP_DONE 0x00000000 /* inactive */
76 #define UMEM_REAP_ADDING 0x00000001 /* umem_reap() is active */
77 #define UMEM_REAP_ACTIVE 0x00000002 /* update thread is reaping */
79 extern uintptr_t umem_tmem_off
;
84 extern uint32_t umem_max_ncpus
;
86 extern uint32_t umem_stack_depth
;
87 extern uint32_t umem_reap_interval
;
88 extern uint32_t umem_update_interval
;
89 extern uint32_t umem_depot_contention
;
90 extern uint32_t umem_abort
;
91 extern uint32_t umem_output
;
92 extern uint32_t umem_logging
;
93 extern uint32_t umem_mtbf
;
94 extern size_t umem_transaction_log_size
;
95 extern size_t umem_content_log_size
;
96 extern size_t umem_failure_log_size
;
97 extern size_t umem_slab_log_size
;
98 extern size_t umem_content_maxsave
;
99 extern size_t umem_lite_minsize
;
100 extern size_t umem_lite_maxalign
;
101 extern size_t umem_maxverify
;
102 extern size_t umem_minfirewall
;
103 extern size_t umem_ptc_size
;
105 extern uint32_t umem_flags
;
108 * umem.c: Internal aliases (to avoid PLTs)
110 extern void *_umem_alloc(size_t size
, int umflags
);
111 extern void *_umem_zalloc(size_t size
, int umflags
);
112 extern void _umem_free(void *buf
, size_t size
);
114 extern void *_umem_cache_alloc(umem_cache_t
*cache
, int flags
);
115 extern void _umem_cache_free(umem_cache_t
*cache
, void *buffer
);
118 * umem.c: private interfaces
120 extern void umem_type_init(caddr_t
, size_t, size_t);
121 extern int umem_get_max_ncpus(void);
122 extern void umem_process_updates(void);
123 extern void umem_cache_applyall(void (*)(umem_cache_t
*));
124 extern void umem_cache_update(umem_cache_t
*);
126 extern void umem_alloc_sizes_add(size_t);
127 extern void umem_alloc_sizes_clear(void);
128 extern void umem_alloc_sizes_remove(size_t);
131 * umem_fork.c: private interfaces
133 extern void umem_forkhandler_init(void);
136 * umem_update_thread.c
138 extern int umem_create_update_thread(void);
143 void umem_setup_envvars(int);
144 void umem_process_envvars(void);
147 * umem_genasm.c: private interfaces
149 extern const int umem_genasm_supported
;
150 extern int umem_genasm(int *, umem_cache_t
**, int);
153 * malloc.c: traditional malloc/free interface for genasm
155 extern void *umem_malloc(size_t);
156 extern void umem_malloc_free(void *);
157 extern void *_malloc(size_t);
158 extern void _free(void *);
164 #endif /* _UMEM_BASE_H */