--- libaitio/inc/aitio.h 2012/05/23 11:49:34 1.18.2.2 +++ libaitio/inc/aitio.h 2012/05/23 13:53:00 1.18.2.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitio.h,v 1.18.2.2 2012/05/23 11:49:34 misho Exp $ +* $Id: aitio.h,v 1.18.2.4 2012/05/23 13:53:00 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -49,6 +49,8 @@ SUCH DAMAGE. #define COMPAT_43TTY +#include +#include #include #include #include @@ -60,7 +62,7 @@ SUCH DAMAGE. #include -#ifdef INIT_MPOOL +#ifdef USE_MPOOL #else #define xmalloc(x) malloc(x) #define xcalloc(x, y) calloc(x, y) @@ -69,6 +71,9 @@ SUCH DAMAGE. #define xfree(x) free(x) #endif +#define IO_SYSM 0 +#define IO_MPOOL 1 + #define VACUUM_LEFT 1 #define VACUUM_BETWEEN 2 @@ -299,6 +304,32 @@ typedef union { inline int io_GetErrno(); // io_GetError() Get error text of last operation inline const char *io_GetError(); + + +// io_mm_inuse() Check for memory management model +inline int io_mm_inuse(); + +/* + * ioLibInit() - Init libaitio library memory management + * + * @mm = memory management (IO_SYSM or IO_MPOOL) + * @maxmem = memory limit + * return: -1 error or !=-1 used memory management model + */ +inline int ioLibInit(int mm, unsigned long maxmem); +/* + * ioLibFini() - Finish libaitio library memory management + * + * return: none + */ +inline void ioLibFini(); + +/* memory management hooks */ +extern void *(*io_malloc)(size_t); +extern void *(*io_calloc)(size_t, size_t); +extern void *(*io_realloc)(void*, size_t); +extern char *(*io_strdup)(const char*); +extern void (*io_free)(void*); /*