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 (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _UMEM_H
2N/A#define _UMEM_H
2N/A
2N/A#include <sys/types.h>
2N/A#include <sys/vmem.h>
2N/A#include <stdlib.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define UMEM_DEFAULT 0x0000 /* normal -- may fail */
2N/A#define UMEM_NOFAIL 0x0100 /* Never fails -- may call exit(2) */
2N/A
2N/A#define UMEM_FLAGS 0xffff /* all settable umem flags */
2N/A
2N/Aextern void *umem_alloc(size_t, int);
2N/Aextern void *umem_alloc_align(size_t, size_t, int);
2N/Aextern void *umem_zalloc(size_t, int);
2N/Aextern void umem_free(void *, size_t);
2N/Aextern void umem_free_align(void *, size_t);
2N/A
2N/A/*
2N/A * Flags for umem_cache_create()
2N/A */
2N/A#define UMC_NOTOUCH 0x00010000
2N/A#define UMC_NODEBUG 0x00020000
2N/A#define UMC_NOMAGAZINE 0x00040000
2N/A#define UMC_NOHASH 0x00080000
2N/A
2N/Astruct umem_cache; /* cache structure is opaque to umem clients */
2N/A
2N/Atypedef struct umem_cache umem_cache_t;
2N/Atypedef int umem_constructor_t(void *, void *, int);
2N/Atypedef void umem_destructor_t(void *, void *);
2N/Atypedef void umem_reclaim_t(void *);
2N/A
2N/Atypedef int umem_nofail_callback_t(void);
2N/A#define UMEM_CALLBACK_RETRY 0
2N/A#define UMEM_CALLBACK_EXIT(status) (0x100 | ((status) & 0xFF))
2N/A
2N/Aextern void umem_nofail_callback(umem_nofail_callback_t *);
2N/A
2N/Aextern umem_cache_t *umem_cache_create(char *, size_t,
2N/A size_t, umem_constructor_t *, umem_destructor_t *, umem_reclaim_t *,
2N/A void *, vmem_t *, int);
2N/Aextern void umem_cache_destroy(umem_cache_t *);
2N/A
2N/Aextern void *umem_cache_alloc(umem_cache_t *, int);
2N/Aextern void umem_cache_free(umem_cache_t *, void *);
2N/A
2N/Aextern void umem_reap(void);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _UMEM_H */