*/
/**
- * \brief Write data to virtual console.
+ * \brief Send data to virtual console.
* \ingroup l4_vcon_api
*
* \param vcon Vcon object.
* \note Size must not exceed L4_VCON_WRITE_SIZE.
*/
L4_INLINE l4_msgtag_t
-l4_vcon_write(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW;
+l4_vcon_send(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW;
/**
* \internal
*/
L4_INLINE l4_msgtag_t
+l4_vcon_send_u(l4_cap_idx_t vcon, char const *buf, int size, l4_utcb_t *utcb) L4_NOTHROW;
+
+
+/**
+ * \brief Write data to virtual console.
+ * \ingroup l4_vcon_api
+ *
+ * \param vcon Vcon object.
+ * \param buf Pointer to data buffer.
+ * \param size Size of buffer in bytes.
+ *
+ * \return Number of bytes written to the virtual console.
+ */
+L4_INLINE long
+l4_vcon_write(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW;
+
+/**
+ * \internal
+ */
+L4_INLINE long
l4_vcon_write_u(l4_cap_idx_t vcon, char const *buf, int size, l4_utcb_t *utcb) L4_NOTHROW;
/**
/******* Implementations ********************/
L4_INLINE l4_msgtag_t
-l4_vcon_write_u(l4_cap_idx_t vcon, char const *buf, int size, l4_utcb_t *utcb) L4_NOTHROW
+l4_vcon_send_u(l4_cap_idx_t vcon, char const *buf, int size, l4_utcb_t *utcb) L4_NOTHROW
{
l4_msg_regs_t *mr = l4_utcb_mr_u(utcb);
mr->mr[0] = L4_VCON_WRITE_OP;
L4_IPC_NEVER);
}
+L4_INLINE l4_msgtag_t
+l4_vcon_send(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW
+{
+ return l4_vcon_send_u(vcon, buf, size, l4_utcb());
+}
+
+L4_INLINE long
+l4_vcon_write_u(l4_cap_idx_t vcon, char const *buf, int size, l4_utcb_t *utcb) L4_NOTHROW
+{
+ l4_msgtag_t t;
+
+ if (size > L4_VCON_WRITE_SIZE)
+ size = L4_VCON_WRITE_SIZE;
+
+ t = l4_vcon_send_u(vcon, buf, size, utcb);
+ if (l4_msgtag_has_error(t))
+ return l4_error(t);
+
+ return size;
+}
+
+L4_INLINE long
+l4_vcon_write(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW
+{
+ return l4_vcon_write_u(vcon, buf, size, l4_utcb());
+}
+
L4_INLINE int
l4_vcon_read_u(l4_cap_idx_t vcon, char *buf, int size, l4_utcb_t *utcb) L4_NOTHROW
{
return ret;
}
-L4_INLINE l4_msgtag_t
-l4_vcon_write(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW
-{
- return l4_vcon_write_u(vcon, buf, size, l4_utcb());
-}
-
L4_INLINE int
l4_vcon_read(l4_cap_idx_t vcon, char *buf, int size) L4_NOTHROW
{