xref: /onnv-gate/usr/src/lib/libumem/common/umem_base.h (revision 1528:30ad6286c4a5)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*1528Sjwadams  * Common Development and Distribution License (the "License").
6*1528Sjwadams  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*1528Sjwadams  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_UMEM_BASE_H
270Sstevel@tonic-gate #define	_UMEM_BASE_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #include <umem_impl.h>
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifdef	__cplusplus
340Sstevel@tonic-gate extern "C" {
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #include "misc.h"
380Sstevel@tonic-gate 
390Sstevel@tonic-gate extern size_t pagesize;
400Sstevel@tonic-gate #undef PAGESIZE
410Sstevel@tonic-gate #define	PAGESIZE	pagesize
420Sstevel@tonic-gate 
430Sstevel@tonic-gate /*
440Sstevel@tonic-gate  * umem.c: non-tunables
450Sstevel@tonic-gate  */
460Sstevel@tonic-gate extern vmem_t		*umem_memalign_arena;
470Sstevel@tonic-gate 
480Sstevel@tonic-gate extern int umem_ready;
490Sstevel@tonic-gate extern thread_t umem_init_thr;		/* the thread doing the init */
500Sstevel@tonic-gate 
510Sstevel@tonic-gate extern int umem_init(void);		/* do umem's initialization */
520Sstevel@tonic-gate #pragma rarely_called(umem_init)
530Sstevel@tonic-gate 
540Sstevel@tonic-gate extern umem_log_header_t *umem_transaction_log;
550Sstevel@tonic-gate extern umem_log_header_t *umem_content_log;
560Sstevel@tonic-gate extern umem_log_header_t *umem_failure_log;
570Sstevel@tonic-gate extern umem_log_header_t *umem_slab_log;
580Sstevel@tonic-gate 
590Sstevel@tonic-gate extern mutex_t umem_init_lock;
600Sstevel@tonic-gate 
610Sstevel@tonic-gate extern mutex_t umem_cache_lock;
620Sstevel@tonic-gate extern umem_cache_t umem_null_cache;
630Sstevel@tonic-gate 
640Sstevel@tonic-gate extern mutex_t umem_flags_lock;
650Sstevel@tonic-gate 
660Sstevel@tonic-gate extern mutex_t umem_update_lock;
670Sstevel@tonic-gate extern cond_t umem_update_cv;
680Sstevel@tonic-gate extern volatile thread_t umem_st_update_thr;
690Sstevel@tonic-gate extern thread_t umem_update_thr;
700Sstevel@tonic-gate extern struct timeval	umem_update_next;
710Sstevel@tonic-gate 
720Sstevel@tonic-gate extern volatile hrtime_t umem_reap_next;
730Sstevel@tonic-gate extern volatile uint32_t umem_reaping;
740Sstevel@tonic-gate #define	UMEM_REAP_DONE		0x00000000	/* inactive */
750Sstevel@tonic-gate #define	UMEM_REAP_ADDING	0x00000001	/* umem_reap() is active */
760Sstevel@tonic-gate #define	UMEM_REAP_ACTIVE	0x00000002	/* update thread is reaping */
770Sstevel@tonic-gate 
780Sstevel@tonic-gate /*
790Sstevel@tonic-gate  * umem.c: tunables
800Sstevel@tonic-gate  */
810Sstevel@tonic-gate extern uint32_t umem_max_ncpus;
820Sstevel@tonic-gate 
830Sstevel@tonic-gate extern uint32_t umem_stack_depth;
840Sstevel@tonic-gate extern uint32_t umem_reap_interval;
850Sstevel@tonic-gate extern uint32_t umem_update_interval;
860Sstevel@tonic-gate extern uint32_t umem_depot_contention;
870Sstevel@tonic-gate extern uint32_t umem_abort;
880Sstevel@tonic-gate extern uint32_t umem_output;
890Sstevel@tonic-gate extern uint32_t umem_logging;
900Sstevel@tonic-gate extern uint32_t umem_mtbf;
910Sstevel@tonic-gate extern size_t umem_transaction_log_size;
920Sstevel@tonic-gate extern size_t umem_content_log_size;
930Sstevel@tonic-gate extern size_t umem_failure_log_size;
940Sstevel@tonic-gate extern size_t umem_slab_log_size;
950Sstevel@tonic-gate extern size_t umem_content_maxsave;
960Sstevel@tonic-gate extern size_t umem_lite_minsize;
970Sstevel@tonic-gate extern size_t umem_lite_maxalign;
980Sstevel@tonic-gate extern size_t umem_maxverify;
990Sstevel@tonic-gate extern size_t umem_minfirewall;
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate extern uint32_t umem_flags;
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate /*
1040Sstevel@tonic-gate  * umem.c: Internal aliases (to avoid PLTs)
1050Sstevel@tonic-gate  */
1060Sstevel@tonic-gate extern void *_umem_alloc(size_t size, int umflags);
1070Sstevel@tonic-gate extern void *_umem_zalloc(size_t size, int umflags);
1080Sstevel@tonic-gate extern void _umem_free(void *buf, size_t size);
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate extern void *_umem_cache_alloc(umem_cache_t *cache, int flags);
1110Sstevel@tonic-gate extern void _umem_cache_free(umem_cache_t *cache, void *buffer);
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate /*
1140Sstevel@tonic-gate  * umem.c: private interfaces
1150Sstevel@tonic-gate  */
1160Sstevel@tonic-gate extern void umem_type_init(caddr_t, size_t, size_t);
1170Sstevel@tonic-gate extern int umem_get_max_ncpus(void);
1180Sstevel@tonic-gate extern void umem_process_updates(void);
1190Sstevel@tonic-gate extern void umem_cache_applyall(void (*)(umem_cache_t *));
1200Sstevel@tonic-gate extern void umem_cache_update(umem_cache_t *);
1210Sstevel@tonic-gate 
122*1528Sjwadams extern void umem_alloc_sizes_add(size_t);
123*1528Sjwadams extern void umem_alloc_sizes_clear(void);
124*1528Sjwadams extern void umem_alloc_sizes_remove(size_t);
125*1528Sjwadams 
1260Sstevel@tonic-gate /*
1270Sstevel@tonic-gate  * umem_fork.c: private interfaces
1280Sstevel@tonic-gate  */
1290Sstevel@tonic-gate extern void umem_forkhandler_init(void);
1300Sstevel@tonic-gate 
1310Sstevel@tonic-gate /*
1320Sstevel@tonic-gate  * umem_update_thread.c
1330Sstevel@tonic-gate  */
1340Sstevel@tonic-gate extern int umem_create_update_thread(void);
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate /*
1370Sstevel@tonic-gate  * envvar.c:
1380Sstevel@tonic-gate  */
1390Sstevel@tonic-gate void umem_setup_envvars(int);
1400Sstevel@tonic-gate void umem_process_envvars(void);
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate #ifdef	__cplusplus
1430Sstevel@tonic-gate }
1440Sstevel@tonic-gate #endif
1450Sstevel@tonic-gate 
1460Sstevel@tonic-gate #endif	/* _UMEM_BASE_H */
147