/*
* Copyright (c) 2000-2001, 2003 Proofpoint, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
* $Id: rpool.h,v 1.17 2013-11-22 20:51:31 ca Exp $
*/
/*
** libsm resource pools
** See libsm/rpool.html for documentation.
*/
#ifndef SM_RPOOL_H
# define SM_RPOOL_H
/*
** Each memory pool object consists of an SM_POOLLINK_T,
** followed by a platform specific amount of padding,
** followed by 'poolsize' bytes of pool data,
** where 'poolsize' is the value of rpool->sm_poolsize at the time
** the pool is allocated.
*/
struct sm_poollink
{
};
struct sm_resource
{
/*
** Function for freeing this resource. It may be NULL,
** meaning that this resource has already been freed.
*/
};
struct sm_rlist
{
};
typedef struct
{
/* Points to SmRpoolMagic, or is NULL if rpool is freed. */
const char *sm_magic;
/*
** If this rpool object has no parent, then sm_parentlink
** is NULL. Otherwise, we set *sm_parentlink = NULL
** when this rpool is freed, so that it isn't freed a
** second time when the parent is freed.
*/
/*
** Memory pools
*/
/* Size of the next pool to be allocated, not including the header. */
/*
** If an sm_rpool_malloc_x request is too big to fit
** in the current pool, and the request size > bigobjectsize,
** then the object will be given its own malloc'ed block.
** sm_bigobjectsize <= sm_poolsize. The maximum wasted space
** at the end of a pool is maxpooledobjectsize - 1.
*/
/* Points to next free byte in the current pool. */
char *sm_poolptr;
/*
** Number of bytes available in the current pool.
** Initially 0. Set to 0 by sm_rpool_free.
*/
/* Linked list of memory pools. Initially NULL. */
/*
** Resource lists
*/
/*
** Number of available resource slots in current list.
** Initially 0. Set to 0 by sm_rpool_free.
*/
/* Linked list of resource lists. Initially NULL. */
#if _FFR_PERF_RPOOL
int sm_nbigblocks;
int sm_npools;
#endif /* _FFR_PERF_RPOOL */
} SM_RPOOL_T;
extern SM_RPOOL_T *
SM_RPOOL_T *_parent));
extern void
SM_RPOOL_T *_rpool));
# if SM_HEAP_CHECK
extern void *
char *_file,
int _line,
int _group));
extern void *
char *_file,
int _line,
int _group));
# else /* SM_HEAP_CHECK */
extern void *
extern void *
# endif /* SM_HEAP_CHECK */
#else /* DO_NOT_USE_STRCPY */
#endif /* DO_NOT_USE_STRCPY */
extern SM_RPOOL_ATTACH_T
void *_rcontext));
extern void
#endif /* ! SM_RPOOL_H */