]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/zn_malloc.c
Merge remote-tracking branch 'origin/mdb.master'
[openldap] / servers / slapd / zn_malloc.c
index 328616d19ba625670b470ac0a54e7679c8a61a2d..7f8694763fb94b9130787712341ad46ba5cd9aa5 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$*/
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2004 The OpenLDAP Foundation.
+ * Copyright 2003-2012 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * top-level directory of the distribution or, alternatively, at
  * <http://www.OpenLDAP.org/license.html>.
  */
-/* Copyright 2004 IBM Corporation
+/* Portions Copyright 2004 IBM Corporation
  * All rights reserved.
- * Redisribution and use in source and binary forms, with or without
- * modification, are permitted only as  authorizd by the OpenLADP
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
  * Public License.
  */
 /* ACKNOWLEDGEMENTS
- * This work originally developed by Jong-Hyuk Choi
- * 2004/12/09   jongchoi@OpenLDAP.org
+ * This work originally developed by Jong-Hyuk Choi for inclusion in
+ * OpenLDAP Software.
  */
 
 #include "portable.h"
 #include <stdio.h>
 #include <ac/string.h>
 #include <sys/types.h>
-#include <sys/mman.h>
 #include <fcntl.h>
 
 #include "slap.h"
 
 #ifdef SLAP_ZONE_ALLOC
 
+#include <sys/mman.h>
+
 static int slap_zone_cmp(const void *v1, const void *v2);
 void * slap_replenish_zopool(void *ctx);
 
@@ -328,7 +329,7 @@ retry:
                if ( zh->zh_maxzones < zh->zh_numzones + zh->zh_deltazones ) {
                        ldap_pvt_thread_mutex_unlock( &zh->zh_mutex );
                        Debug( LDAP_DEBUG_TRACE,
-                               "slap_zn_malloc of %lu bytes failed, using ch_malloc\n",
+                               "zn_malloc %lu: ch_malloc\n",
                                (long)size, 0, 0);
                        Debug(LDAP_DEBUG_NONE,
                                "slap_zn_malloc: returning 0x%x, 0x%x\n",
@@ -541,7 +542,7 @@ slap_zn_free(void *ptr, void *ctx)
                                                Debug(LDAP_DEBUG_ANY, "slap_zn_free: "
                                                        "free object not found while bit is clear.\n",
                                                        0, 0, 0);
-                                               assert(zo);
+                                               assert(zo != NULL);
 
                                        }
                                } else {
@@ -603,7 +604,7 @@ slap_zn_free(void *ptr, void *ctx)
                                                Debug(LDAP_DEBUG_ANY, "slap_zn_free: "
                                                        "free object not found while bit is clear.\n",
                                                        0, 0, 0 );
-                                               assert( zo );
+                                               assert(zo != NULL);
 
                                        }
                                } else {
@@ -928,7 +929,7 @@ slap_measure_timing(struct timeval *tv_set, struct timeval *tv_measure)
 int
 slap_zn_latency_history(void* ctx, int ea_latency)
 {
-/* TODO: monitor /proc/swap as well */
+/* TODO: monitor /proc/stat (swap) as well */
        struct zone_heap* zh = ctx;
        double t_diff = 0.0;