umem.h

Go to the documentation of this file.
00001 /*
00002  * CDDL HEADER START
00003  *
00004  * The contents of this file are subject to the terms of the
00005  * Common Development and Distribution License, Version 1.0 only
00006  * (the "License").  You may not use this file except in compliance
00007  * with the License.
00008  *
00009  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
00010  * or http://www.opensolaris.org/os/licensing.
00011  * See the License for the specific language governing permissions
00012  * and limitations under the License.
00013  *
00014  * When distributing Covered Code, include this CDDL HEADER in each
00015  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
00016  * If applicable, add the following below this CDDL HEADER, with the
00017  * fields enclosed by brackets "[]" replaced with your own identifying
00018  * information: Portions Copyright [yyyy] [name of copyright owner]
00019  *
00020  * CDDL HEADER END
00021  */
00022 /*
00023  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
00024  * Use is subject to license terms.
00025  */
00026 
00027 #ifndef _UMEM_H
00028 #define _UMEM_H
00029 
00030 /* #pragma ident        "@(#)umem.h     1.3     05/06/08 SMI" */
00031 
00032 #include <sys/types.h>
00033 #include <sys/vmem.h>
00034 #include <stdlib.h>
00035 
00036 #ifdef  __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 #define UMEM_DEFAULT    0x0000  /* normal -- may fail */
00041 #define UMEM_NOFAIL     0x0100  /* Never fails -- may call exit(2) */
00042 
00043 #define UMEM_FLAGS      0xffff  /* all settable umem flags */
00044 
00045 extern void *umem_alloc(size_t, int);
00046 extern void *umem_alloc_align(size_t, size_t, int);
00047 extern void *umem_zalloc(size_t, int);
00048 extern void umem_free(void *, size_t);
00049 extern void umem_free_align(void *, size_t);
00050 
00055 #define UMC_NOTOUCH     0x00010000
00056 #define UMC_NODEBUG     0x00020000
00057 #define UMC_NOMAGAZINE  0x00040000
00058 #define UMC_NOHASH      0x00080000
00059 
00061 struct umem_cache;              /* cache structure is opaque to umem clients */
00062 
00063 typedef struct umem_cache umem_cache_t;
00064 typedef int umem_constructor_t(void *, void *, int);
00065 typedef void umem_destructor_t(void *, void *);
00066 typedef void umem_reclaim_t(void *);
00067 
00068 typedef int umem_nofail_callback_t(void);
00069 #define UMEM_CALLBACK_RETRY             0
00070 #define UMEM_CALLBACK_EXIT(status)      (0x100 | ((status) & 0xFF))
00071 
00072 extern void umem_nofail_callback(umem_nofail_callback_t *);
00073 
00074 extern umem_cache_t *umem_cache_create(char *, size_t,
00075     size_t, umem_constructor_t *, umem_destructor_t *, umem_reclaim_t *,
00076     void *, vmem_t *, int);
00077 extern void umem_cache_destroy(umem_cache_t *);
00078 
00079 extern void *umem_cache_alloc(umem_cache_t *, int);
00080 extern void umem_cache_free(umem_cache_t *, void *);
00081 
00082 extern void umem_reap(void);
00083 
00084 #ifdef  __cplusplus
00085 }
00086 #endif
00087 
00088 #endif  /* _UMEM_H */

Generated on Thu Feb 7 05:40:23 2008 for umem by  doxygen 1.5.4