summaryrefslogtreecommitdiffstats
path: root/cpukit/sapi/include/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-07-21 10:15:02 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-07-22 09:13:07 +0200
commit059529e685e059d366ee56aa6117ee0d4e899e66 (patch)
tree77255d92003c98d84f558f6dbc27d474a842cf83 /cpukit/sapi/include/rtems
parentposix: Fix double chain extract (diff)
downloadrtems-059529e685e059d366ee56aa6117ee0d4e899e66.tar.bz2
score: Add debug support to chains
This helps to detect * double insert, append, prepend errors, and * get from empty chain errors.
Diffstat (limited to 'cpukit/sapi/include/rtems')
-rw-r--r--cpukit/sapi/include/rtems/chain.h15
-rw-r--r--cpukit/sapi/include/rtems/rbheap.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/cpukit/sapi/include/rtems/chain.h b/cpukit/sapi/include/rtems/chain.h
index 3d8a860f20..25f02c9ba8 100644
--- a/cpukit/sapi/include/rtems/chain.h
+++ b/cpukit/sapi/include/rtems/chain.h
@@ -188,6 +188,21 @@ RTEMS_INLINE_ROUTINE void rtems_chain_set_off_chain(
}
/**
+ * @brief Initializes a chain node.
+ *
+ * In debug configurations, the node is set off chain. In all other
+ * configurations, this function does nothing.
+ *
+ * @param[in] the_node The chain node to initialize.
+ */
+RTEMS_INLINE_ROUTINE void rtems_chain_initialize_node(
+ rtems_chain_node *node
+)
+{
+ _Chain_Initialize_node( node );
+}
+
+/**
* @brief Is the node off chain.
*
* This function returns true if the @a node is not on a chain. A @a node is
diff --git a/cpukit/sapi/include/rtems/rbheap.h b/cpukit/sapi/include/rtems/rbheap.h
index c008721b23..735aa6c8fd 100644
--- a/cpukit/sapi/include/rtems/rbheap.h
+++ b/cpukit/sapi/include/rtems/rbheap.h
@@ -210,6 +210,7 @@ static inline void rtems_rbheap_add_to_spare_descriptor_chain(
rtems_chain_control *chain =
rtems_rbheap_get_spare_descriptor_chain(control);
+ rtems_chain_initialize_node(&chunk->chain_node);
rtems_chain_prepend_unprotected(chain, &chunk->chain_node);
}