X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/359df77829d85c6a415220fb4f21d5331323c79f..2b645fb792c62ae0d38fcde4c39e1bd0889b0e06:/lmem.h diff --git a/lmem.h b/lmem.h index 8546dcf..3f84c6e 100644 --- a/lmem.h +++ b/lmem.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: lmem.h,v 1.1 1999/12/22 16:02:52 mdw Exp $ + * $Id: lmem.h,v 1.4 2000/12/06 20:33:27 mdw Exp $ * * Locked memory allocation * @@ -30,6 +30,16 @@ /*----- Revision history --------------------------------------------------* * * $Log: lmem.h,v $ + * Revision 1.4 2000/12/06 20:33:27 mdw + * Make flags be macros rather than enumerations, to ensure that they're + * unsigned. + * + * Revision 1.3 2000/07/29 21:58:15 mdw + * (l_destroy): New function for destroying locked memory blocks. + * + * Revision 1.2 2000/06/17 11:29:38 mdw + * Add arena support. + * * Revision 1.1 1999/12/22 16:02:52 mdw * Interface to allocating `locked' memory (which isn't paged out). * @@ -46,6 +56,7 @@ #include +#include #include /*----- Data structures ---------------------------------------------------*/ @@ -65,13 +76,13 @@ typedef struct l_node { unsigned f; /* Various flags */ } l_node; -enum { - LF_ALLOC = 1 -}; +#define LF_ALLOC 1u /* --- Locked memory buffer state --- */ typedef struct lmem { + arena a; /* Arena header block */ + unsigned f; /* Various flags */ char *p; /* Pointer to locked buffer */ l_node *l; /* Pointer to block list */ size_t sz; /* Size of locked buffer */ @@ -79,6 +90,8 @@ typedef struct lmem { int err; char *emsg; /* Error indicators */ } lmem; +#define LF_LOCKED 1u + /*----- Functions provided ------------------------------------------------*/ /* --- @l_init@ --- * @@ -135,6 +148,17 @@ extern void l_free(lmem */*lm*/, void */*p*/); extern void l_purge(lmem */*lm*/); +/* --- @l_destroy@ --- * + * + * Arguments: @lmem *lm@ = pointer to locked memory descriptor + * + * Returns: --- + * + * Use: Disposes of a locked memory arena permanently. + */ + +extern void l_destroy(lmem */*lm*/); + /* --- @l_report@ --- * * * Arguments: @lmem *lm@ = pointer to locked memory descriptor