*
* https://labs.omniti.com/trac/portableumem
*/
+#include <sys/debug.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#ifdef __cplusplus
extern "C" {
/*
* Flags for umem_cache_create()
*/
-#define UMC_NOTOUCH 0x00010000
#define UMC_NODEBUG 0x00020000
-#define UMC_NOMAGAZINE 0x00040000
-#define UMC_NOHASH 0x00080000
#define UMEM_CACHE_NAMELEN 31
int cache_cflags;
} umem_cache_t;
+/* Prototypes for functions to provide defaults for umem envvars */
+const char *_umem_debug_init(void);
+const char *_umem_options_init(void);
+const char *_umem_logging_init(void);
+
static inline void *
umem_alloc(size_t size, int flags)
{
}
static inline void
-umem_free(void *ptr, size_t size)
+umem_free(void *ptr, size_t size __maybe_unused)
{
free(ptr);
}
static inline void
-umem_nofail_callback(umem_nofail_callback_t *cb) {}
+umem_nofail_callback(umem_nofail_callback_t *cb __maybe_unused)
+{}
static inline umem_cache_t *
umem_cache_create(
{
umem_cache_t *cp;
- cp = umem_alloc(sizeof (umem_cache_t), UMEM_DEFAULT);
+ cp = (umem_cache_t *)umem_alloc(sizeof (umem_cache_t), UMEM_DEFAULT);
if (cp) {
- strncpy(cp->cache_name, name, UMEM_CACHE_NAMELEN);
+ strlcpy(cp->cache_name, name, UMEM_CACHE_NAMELEN);
cp->cache_bufsize = bufsize;
cp->cache_align = align;
cp->cache_constructor = constructor;
}
static inline void
-umem_cache_reap_now(umem_cache_t *cp)
+umem_cache_reap_now(umem_cache_t *cp __maybe_unused)
{
}