Index: ossp-pkg/mm/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/mm/ChangeLog,v rcsdiff -q -kk '-r1.55' '-r1.56' -u '/v/ossp/cvs/ossp-pkg/mm/ChangeLog,v' 2>/dev/null --- ChangeLog 2006/06/10 07:34:54 1.55 +++ ChangeLog 2006/06/10 21:25:54 1.56 @@ -11,6 +11,9 @@ Changes between 1.4.0 and 1.4.1 (02-Sep-2005 to 12-Oct-2005) + *) Add new API function MM_reset() and mm_reset(). + [Neil Conway ] + *) Upgraded build environment to GNU shtool 2.0.6 and GNU libtool 1.5.22 [Ralf S. Engelschall] Index: ossp-pkg/mm/mm.h RCS File: /v/ossp/cvs/ossp-pkg/mm/mm.h,v rcsdiff -q -kk '-r1.30' '-r1.31' -u '/v/ossp/cvs/ossp-pkg/mm/mm.h,v' 2>/dev/null --- mm.h 2005/09/02 20:00:46 1.30 +++ mm.h 2006/06/10 21:25:54 1.31 @@ -331,6 +331,7 @@ /* Global Malloc-Replacement API */ int MM_create(size_t, const char *); int MM_permission(mode_t, uid_t, gid_t); +void MM_reset(void); void MM_destroy(void); int MM_lock(mm_lock_mode); int MM_unlock(void); @@ -347,6 +348,7 @@ /* Standard Malloc-Style API */ MM *mm_create(size_t, const char *); int mm_permission(MM *, mode_t, uid_t, gid_t); +void mm_reset(MM *); void mm_destroy(MM *); int mm_lock(MM *, mm_lock_mode); int mm_unlock(MM *); Index: ossp-pkg/mm/mm.pod RCS File: /v/ossp/cvs/ossp-pkg/mm/mm.pod,v rcsdiff -q -kk '-r1.28' '-r1.29' -u '/v/ossp/cvs/ossp-pkg/mm/mm.pod,v' 2>/dev/null --- mm.pod 2006/06/10 21:14:02 1.28 +++ mm.pod 2006/06/10 21:25:54 1.29 @@ -60,6 +60,7 @@ int MM_create(size_t size, const char *file); int MM_permission(mode_t mode, uid_t owner, gid_t group); + void MM_reset(void); void MM_destroy(void); int MM_lock(mm_lock_mode mode); int MM_unlock(void); @@ -77,6 +78,7 @@ MM *mm_create(size_t size, char *file); int mm_permission(MM *mm, mode_t mode, uid_t owner, gid_t group); + void mm_reset(MM *mm); void mm_destroy(MM *mm); int mm_lock(MM *mm, mm_lock_mode mode); int mm_unlock(MM *mm); @@ -307,6 +309,12 @@ implementation is actually based on external auxiliary files). The arguments are directly passed through to chmod(2) and chown(2). +=item void B(void); + +This resets the global shared memory pool: all chunks that have been +allocated in the pool are marked as free and are eligible for reuse. The +global memory pool itself is not destroyed. + =item void B(void); This destroys the global shared memory pool and should be called I all @@ -395,6 +403,12 @@ implementation is actually based on external auxiliary files). The arguments are directly passed through to chmod(2) and chown(2). +=item void B(MM *I); + +This resets the shared memory pool I: all chunks that have been +allocated in the pool are marked as free and are eligible for reuse. The +memory pool itself is not destroyed. + =item void B(MM *I); This destroys the complete shared memory pool I and with it all chunks Index: ossp-pkg/mm/mm_alloc.c RCS File: /v/ossp/cvs/ossp-pkg/mm/mm_alloc.c,v rcsdiff -q -kk '-r1.23' '-r1.24' -u '/v/ossp/cvs/ossp-pkg/mm/mm_alloc.c,v' 2>/dev/null --- mm_alloc.c 2006/06/10 21:12:35 1.23 +++ mm_alloc.c 2006/06/10 21:25:54 1.24 @@ -98,6 +98,19 @@ } /* + * Reset a memory pool. + */ +void mm_reset(MM *mm) +{ + if (mm == NULL) + return; + mm->mp_offset = SIZEOF_mem_pool; + mm->mp_freechunks.mc_usize = 0; + mm->mp_freechunks.mc_u.mc_next = NULL; + return; +} + +/* * Destroy a memory pool */ void mm_destroy(MM *mm) Index: ossp-pkg/mm/mm_global.c RCS File: /v/ossp/cvs/ossp-pkg/mm/mm_global.c,v rcsdiff -q -kk '-r1.14' '-r1.15' -u '/v/ossp/cvs/ossp-pkg/mm/mm_global.c,v' 2>/dev/null --- mm_global.c 2005/09/02 20:00:46 1.14 +++ mm_global.c 2006/06/10 21:25:55 1.15 @@ -66,6 +66,14 @@ return mm_permission(mm_global, mode, owner, group); } +void MM_reset(void) +{ + if (mm_global == NULL) + return; + mm_reset(mm_global); + return; +} + void MM_destroy(void) { if (mm_global == NULL)