OSSP CVS Repository

ossp - Check-in [5417]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 5417
Date: 2006-Jun-10 23:25:54 (local)
2006-Jun-10 21:25:54 (UTC)
User:rse
Branch:
Comment: Add new API function MM_reset() and mm_reset().

Submitted by: Neil Conway <neilc@samurai.com>

Tickets:
Inspections:
Files:
ossp-pkg/mm/ChangeLog      1.55 -> 1.56     3 inserted, 0 deleted
ossp-pkg/mm/mm.h      1.30 -> 1.31     2 inserted, 0 deleted
ossp-pkg/mm/mm.pod      1.28 -> 1.29     14 inserted, 0 deleted
ossp-pkg/mm/mm_alloc.c      1.23 -> 1.24     13 inserted, 0 deleted
ossp-pkg/mm/mm_global.c      1.14 -> 1.15     8 inserted, 0 deleted

ossp-pkg/mm/ChangeLog 1.55 -> 1.56

--- 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 <neilc@samurai.com>]
+
   *) Upgraded build environment to GNU shtool 2.0.6 and
      GNU libtool 1.5.22
      [Ralf S. Engelschall]


ossp-pkg/mm/mm.h 1.30 -> 1.31

--- 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 *);


ossp-pkg/mm/mm.pod 1.28 -> 1.29

--- 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<MM_reset>(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<MM_destroy>(void);
 
 This destroys the global shared memory pool and should be called I<after> 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_reset>(MM *I<mm>);
+
+This resets the shared memory pool I<mm>: 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_destroy>(MM *I<mm>);
 
 This destroys the complete shared memory pool I<mm> and with it all chunks


ossp-pkg/mm/mm_alloc.c 1.23 -> 1.24

--- 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)


ossp-pkg/mm/mm_global.c 1.14 -> 1.15

--- 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)

CVSTrac 2.0.1