24 namespace L4 {
namespace Ipc {
26 template<
typename CHAR =
char const,
typename LEN =
unsigned long>
27 struct 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 47 template<
typename CHAR = char,
typename LEN_TYPE =
unsigned long,
50 using String_in_buf = Array_in_buf<CHAR, LEN_TYPE, MAX>;
54 template<
typename A,
typename LEN>
55 struct Clnt_xmit< String<A, LEN> > : Clnt_xmit< Array<A, LEN> > {};
57 template<
typename A,
typename LEN,
typename CLASS>
58 struct 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();
81 template<
typename A,
typename LEN>
82 struct 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();
103 template<
typename A,
typename LEN>
104 struct Clnt_xmit<String<A, LEN> *> : Clnt_xmit<String<A, LEN> &> {};
106 template<
typename A,
typename LEN,
typename CLASS>
107 struct Svr_val_ops<String<A, LEN>, Dir_out, CLASS>
108 : Svr_val_ops<Array_ref<A, LEN>, Dir_out, CLASS>
111 template<
typename A,
typename LEN>
113 template<
typename A,
typename LEN>
Total number of message register (MRs) available.
L4 low-level kernel interface.
unsigned long l4_umword_t
Unsigned machine word.