summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-12-18 22:43:01 +0100
committerNeal H. Walfield <neal@gnu.org>2008-12-18 22:43:01 +0100
commitbb5d7d1ddfb8a580b60ae846de5e8ce201e0016d (patch)
tree43c440035bbe281c1abc54b1470d9889c6810bf3
parent60a851e8caed8f1d79e943b3eb099690e72e0c89 (diff)
Add new function vg_message_space.
2008-12-18 Neal H. Walfield <neal@gnu.org> * viengoos/message.h (vg_message_space): New function.
-rw-r--r--libviengoos/ChangeLog4
-rw-r--r--libviengoos/viengoos/message.h8
2 files changed, 12 insertions, 0 deletions
diff --git a/libviengoos/ChangeLog b/libviengoos/ChangeLog
index b21f285..7520696 100644
--- a/libviengoos/ChangeLog
+++ b/libviengoos/ChangeLog
@@ -1,5 +1,9 @@
2008-12-18 Neal H. Walfield <neal@gnu.org>
+ * viengoos/message.h (vg_message_space): New function.
+
+2008-12-18 Neal H. Walfield <neal@gnu.org>
+
* viengoos/rpc.h (RPC_SEND_MARSHAL): Make the reply messenger the
first capability.
(RPC_SEND_UNMARSHAL): Likewise.
diff --git a/libviengoos/viengoos/message.h b/libviengoos/viengoos/message.h
index 514248e..e23c155 100644
--- a/libviengoos/viengoos/message.h
+++ b/libviengoos/viengoos/message.h
@@ -190,6 +190,14 @@ vg_message_word_set (struct vg_message *msg, int pos, uintptr_t word)
((uintptr_t *) vg_message_data (msg))[pos] = word;
}
+/* Return the amount of space (in bytes) remaining in MSG. */
+static inline int
+vg_message_space (struct vg_message *msg)
+{
+ return PAGESIZE - __builtin_offsetof (struct vg_message, caps)
+ - msg->data_count - msg->cap_count * sizeof (vg_addr_t);
+}
+
#include <s-printf.h>
static inline void