24namespace L4 {
namespace Ipc {
26template<
typename CHAR =
char const,
typename LEN =
unsigned long>
27struct String : Array<CHAR, LEN>
29 static LEN strlength(CHAR *d) { LEN l = 0;
while (d[l]) ++l;
return l; }
31 String(CHAR *d) :
Array<CHAR, LEN>(strlength(d) + 1, d) {}
32 String(LEN len, CHAR *d) :
Array<CHAR, LEN>(len, d) {}
33 void copy_in(CHAR
const *s)
39 for (i = 0; i < this->length - 1 && s[i]; ++i)
42 this->data[i] = CHAR();
46#if __cplusplus >= 201103L
47template<
typename CHAR = char,
typename LEN_TYPE =
unsigned long,
48 LEN_TYPE MAX = (L4_UTCB_GENERIC_DATA_SIZE *
50using String_in_buf = Array_in_buf<CHAR, LEN_TYPE, MAX>;
54template<
typename A,
typename LEN>
55struct Clnt_xmit< String<A, LEN> > : Clnt_xmit< Array<A, LEN> > {};
57template<
typename A,
typename LEN,
typename CLASS>
58struct Svr_val_ops< String<A, LEN>, Dir_in, CLASS >
59: Svr_val_ops< Array_ref<A, LEN>, Dir_in, CLASS >
61 typedef Svr_val_ops< Array_ref<A, LEN>, Dir_in, CLASS > Base;
62 typedef typename Base::svr_type svr_type;
64 static int to_svr(
char *msg,
unsigned offset,
unsigned limit,
65 svr_type &a, Dir_in dir, Cls_data cls)
67 int r = Base::to_svr(msg, offset, limit, a, dir, cls);
75 typedef typename L4::Types::Remove_const<A>::type elem_type;
76 const_cast<elem_type*
>(a.data)[a.length - 1] = A();
81template<
typename A,
typename LEN>
82struct Clnt_xmit<String<A, LEN> &> : Clnt_xmit<Array<A, LEN> &>
84 typedef Array<A, LEN> &type;
86 using Clnt_xmit<type>::from_msg;
87 static int from_msg(
char *msg,
unsigned offset,
unsigned limit,
long ret,
88 Array<A, LEN> &a, Dir_out dir, Cls_data cls)
90 int r = Clnt_xmit<type>::from_msg(msg, offset, limit, ret, a, dir, cls);
98 a.data[a.length - 1] = A();
103template<
typename A,
typename LEN>
104struct Clnt_xmit<String<A, LEN> *> : Clnt_xmit<String<A, LEN> &> {};
106template<
typename A,
typename LEN,
typename CLASS>
107struct Svr_val_ops<String<A, LEN>, Dir_out, CLASS>
108: Svr_val_ops<Array_ref<A, LEN>, Dir_out, CLASS>
111template<
typename A,
typename LEN>
113template<
typename A,
typename LEN>
unsigned long l4_umword_t
Unsigned machine word.
@ L4_EMSGTOOSHORT
Message too short.
L4 low-level kernel interface.