summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneal <neal>2008-02-20 10:09:09 +0000
committerneal <neal>2008-02-20 10:09:09 +0000
commit3efe1b4f685f14a0660c6d5d235ebd05b71471ef (patch)
tree5d2ff0d8ff9660766b78551a8a96199c6495c276
parenta0e06d47106a32ffc1f922c6ab39174152c09a9f (diff)
2008-02-20 Neal H. Walfield <neal@gnu.org>
* list.h (struct list) [! NDEBUG]: Add field name. (list_init): Add parameter name. Update users. (LIST_CLASS): Update template to account for list_init changes. (list_unlink): Improve debugging output. * activity.c (activity_prepare): Explicitly initialize all lists.
-rw-r--r--viengoos/ChangeLog8
-rw-r--r--viengoos/activity.c8
-rw-r--r--viengoos/list.h20
-rw-r--r--viengoos/t-link.c6
4 files changed, 33 insertions, 9 deletions
diff --git a/viengoos/ChangeLog b/viengoos/ChangeLog
index 142c129..e0105ad 100644
--- a/viengoos/ChangeLog
+++ b/viengoos/ChangeLog
@@ -1,3 +1,11 @@
+2008-02-20 Neal H. Walfield <neal@gnu.org>
+
+ * list.h (struct list) [! NDEBUG]: Add field name.
+ (list_init): Add parameter name. Update users.
+ (LIST_CLASS): Update template to account for list_init changes.
+ (list_unlink): Improve debugging output.
+ * activity.c (activity_prepare): Explicitly initialize all lists.
+
2008-02-18 Neal H. Walfield <neal@gnu.org>
* server.c (server_loop): When raising a fault, set INFO.DISCARDED
diff --git a/viengoos/activity.c b/viengoos/activity.c
index af08d64..5bd6d4d 100644
--- a/viengoos/activity.c
+++ b/viengoos/activity.c
@@ -300,7 +300,13 @@ activity_prepare (struct activity *principal, struct activity *activity)
activity, last);
}
- activity_children_list_init (&activity->children);
+ activity_children_list_init (&activity->children, "activity->children");
+
+ activity_lru_list_init (&activity->active, "active");
+ activity_lru_list_init (&activity->inactive_clean, "inactive clean");
+ activity_lru_list_init (&activity->inactive_dirty, "inactive dirty");
+ eviction_list_init (&activity->eviction_clean, "evict clean");
+ eviction_list_init (&activity->eviction_dirty, "evict dirty");
}
void
diff --git a/viengoos/list.h b/viengoos/list.h
index 2ab9ea6..16d8c98 100644
--- a/viengoos/list.h
+++ b/viengoos/list.h
@@ -41,6 +41,9 @@ struct list
struct list_node *head;
/* The number of items on the list. */
int count;
+#ifndef NDEBUG
+ const char *name;
+#endif
};
typedef struct list list_t;
@@ -54,10 +57,13 @@ list_node_attached (struct list_node *node)
/* Initialize a list. Equivalently, zero initialization is
sufficient. */
static inline void
-list_init (struct list *list)
+list_init (struct list *list, const char *name)
{
list->head = NULL;
list->count = 0;
+#ifndef NDEBUG
+ list->name = name;
+#endif
}
/* Return whether the pointer is a sentinel. The head's previous
@@ -256,9 +262,13 @@ list_unlink (struct list *list, struct list_node *item)
assert (LIST_SENTINEL_P (i->next));
if (LIST_PTR (i->next) != (void *) list)
- debug (0, "%p appears on %p", item, LIST_PTR (i->next));
+ debug (0, "Item %p appears on %p (%s) not %p (%s)",
+ item, LIST_PTR (i->next),
+ ((struct list *) LIST_PTR (i->next))->name,
+ list, list->name);
LIST_PTR (i->next) == (void *) list;
- }), "list: %p (%d), item: %p", list, list_count (list), item);
+ }), "list: %p (%s) (%d), item: %p",
+ list, list->name, list_count (list), item);
if (LIST_SENTINEL_P (item->next) && LIST_SENTINEL_P (item->prev))
/* The only item on the list. */
@@ -396,9 +406,9 @@ list_join (struct list *target, struct list *source)
LIST_CLASS_TYPE_need_type_##need_type(name) \
\
static inline void \
- name##_list_init (struct name##_list *list) \
+ name##_list_init (struct name##_list *list, const char *name) \
{ \
- list_init (&list->list); \
+ list_init (&list->list, name); \
} \
\
static inline int \
diff --git a/viengoos/t-link.c b/viengoos/t-link.c
index dac3302..a4bea56 100644
--- a/viengoos/t-link.c
+++ b/viengoos/t-link.c
@@ -23,7 +23,7 @@ test (void)
struct object_desc *descs[N];
struct object_activity_lru_list list;
- object_activity_lru_list_init (&list);
+ object_activity_lru_list_init (&list, "list");
struct object_desc *p;
int i;
@@ -88,7 +88,7 @@ test (void)
/* A: 1 -> 2 -> 3. */
struct object_activity_lru_list a;
- object_activity_lru_list_init (&a);
+ object_activity_lru_list_init (&a, "a");
descs[3] = calloc (sizeof (struct object_desc), 1);
descs[3]->age = 3;
@@ -104,7 +104,7 @@ test (void)
/* B: 4 -> 5 -> 6. */
struct object_activity_lru_list b;
- object_activity_lru_list_init (&b);
+ object_activity_lru_list_init (&b, "b");
descs[6] = calloc (sizeof (struct object_desc), 1);
descs[6]->age = 6;