umem_base.h revision 2
2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _UMEM_BASE_H
2N/A#define _UMEM_BASE_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#include <umem_impl.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include "misc.h"
2N/A
2N/Aextern size_t pagesize;
2N/A#undef PAGESIZE
2N/A#define PAGESIZE pagesize
2N/A
2N/A/*
2N/A * umem.c: non-tunables
2N/A */
2N/Aextern vmem_t *umem_memalign_arena;
2N/A
2N/Aextern int umem_ready;
2N/Aextern thread_t umem_init_thr; /* the thread doing the init */
2N/A
2N/Aextern int umem_init(void); /* do umem's initialization */
2N/A#pragma rarely_called(umem_init)
2N/A
2N/Aextern umem_log_header_t *umem_transaction_log;
2N/Aextern umem_log_header_t *umem_content_log;
2N/Aextern umem_log_header_t *umem_failure_log;
2N/Aextern umem_log_header_t *umem_slab_log;
2N/A
2N/Aextern mutex_t umem_init_lock;
2N/A
2N/Aextern mutex_t umem_cache_lock;
2N/Aextern umem_cache_t umem_null_cache;
2N/A
2N/Aextern mutex_t umem_flags_lock;
2N/A
2N/Aextern mutex_t umem_update_lock;
2N/Aextern cond_t umem_update_cv;
2N/Aextern volatile thread_t umem_st_update_thr;
2N/Aextern thread_t umem_update_thr;
2N/Aextern struct timeval umem_update_next;
2N/A
2N/Aextern volatile hrtime_t umem_reap_next;
2N/Aextern volatile uint32_t umem_reaping;
2N/A#define UMEM_REAP_DONE 0x00000000 /* inactive */
2N/A#define UMEM_REAP_ADDING 0x00000001 /* umem_reap() is active */
2N/A#define UMEM_REAP_ACTIVE 0x00000002 /* update thread is reaping */
2N/A
2N/A/*
2N/A * umem.c: tunables
2N/A */
2N/Aextern uint32_t umem_max_ncpus;
2N/A
2N/Aextern uint32_t umem_stack_depth;
2N/Aextern uint32_t umem_reap_interval;
2N/Aextern uint32_t umem_update_interval;
2N/Aextern uint32_t umem_depot_contention;
2N/Aextern uint32_t umem_abort;
2N/Aextern uint32_t umem_output;
2N/Aextern uint32_t umem_logging;
2N/Aextern uint32_t umem_mtbf;
2N/Aextern size_t umem_transaction_log_size;
2N/Aextern size_t umem_content_log_size;
2N/Aextern size_t umem_failure_log_size;
2N/Aextern size_t umem_slab_log_size;
2N/Aextern size_t umem_content_maxsave;
2N/Aextern size_t umem_lite_minsize;
2N/Aextern size_t umem_lite_maxalign;
2N/Aextern size_t umem_maxverify;
2N/Aextern size_t umem_minfirewall;
2N/A
2N/Aextern uint32_t umem_flags;
2N/A
2N/A/*
2N/A * umem.c: Internal aliases (to avoid PLTs)
2N/A */
2N/Aextern void *_umem_alloc(size_t size, int umflags);
2N/Aextern void *_umem_zalloc(size_t size, int umflags);
2N/Aextern void _umem_free(void *buf, size_t size);
2N/A
2N/Aextern void *_umem_cache_alloc(umem_cache_t *cache, int flags);
2N/Aextern void _umem_cache_free(umem_cache_t *cache, void *buffer);
2N/A
2N/A/*
2N/A * umem.c: private interfaces
2N/A */
2N/Aextern void umem_type_init(caddr_t, size_t, size_t);
2N/Aextern int umem_get_max_ncpus(void);
2N/Aextern void umem_process_updates(void);
2N/Aextern void umem_cache_applyall(void (*)(umem_cache_t *));
2N/Aextern void umem_cache_update(umem_cache_t *);
2N/A
2N/Aextern void umem_alloc_sizes_add(size_t);
2N/Aextern void umem_alloc_sizes_clear(void);
2N/Aextern void umem_alloc_sizes_remove(size_t);
2N/A
2N/A/*
2N/A * umem_fork.c: private interfaces
2N/A */
2N/Aextern void umem_forkhandler_init(void);
2N/A
2N/A/*
2N/A * umem_update_thread.c
2N/A */
2N/Aextern int umem_create_update_thread(void);
2N/A
2N/A/*
2N/A * envvar.c:
2N/A */
2N/Avoid umem_setup_envvars(int);
2N/Avoid umem_process_envvars(void);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _UMEM_BASE_H */