summaryrefslogtreecommitdiff
path: root/libhurd-slab
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-06-19 21:20:57 +0200
committerJustus Winter <justus@gnupg.org>2017-08-05 18:42:22 +0200
commit835b293d35a209d38047126443d41fa7090daa4c (patch)
tree5bf956895e6030f91cd618fb191b2151f6d25423 /libhurd-slab
parentdc0b5a43224999223a246870912b0f292b1980e9 (diff)
Use our own variant of 'assert' and 'assert_perror'.
Our variants print stack traces on failures. This will make locating errors much easier.
Diffstat (limited to 'libhurd-slab')
-rw-r--r--libhurd-slab/slab.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libhurd-slab/slab.c b/libhurd-slab/slab.c
index 5a12a43a..f66bfddf 100644
--- a/libhurd-slab/slab.c
+++ b/libhurd-slab/slab.c
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <errno.h>
#include <sys/mman.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
@@ -107,7 +107,7 @@ deallocate_buffer (struct hurd_slab_space *space, void *buffer, size_t size)
static void
insert_slab (struct hurd_slab_space *space, struct hurd_slab *slab)
{
- assert (slab->refcount == 0);
+ assert_backtrace (slab->refcount == 0);
if (space->slab_first == 0)
space->slab_first = space->slab_last = slab;
else
@@ -214,7 +214,7 @@ init_space (hurd_slab_space_t space)
/* If SIZE is so big that one object can not fit into a page
something gotta be really wrong. */
size = (size + alignment - 1) & ~(alignment - 1);
- assert (size <= (space->slab_size
+ assert_backtrace (size <= (space->slab_size
- sizeof (struct hurd_slab)
- sizeof (union hurd_bufctl)));
@@ -488,7 +488,7 @@ put_on_slab_list (struct hurd_slab *slab, union hurd_bufctl *bufctl)
bufctl->next = slab->free_list;
slab->free_list = bufctl;
slab->refcount--;
- assert (slab->refcount >= 0);
+ assert_backtrace (slab->refcount >= 0);
}
@@ -499,7 +499,7 @@ hurd_slab_dealloc (hurd_slab_space_t space, void *buffer)
struct hurd_slab *slab;
union hurd_bufctl *bufctl;
- assert (space->initialized);
+ assert_backtrace (space->initialized);
pthread_mutex_lock (&space->lock);