1.1 --- a/pkg/idl4re-examples/calc++/server.cc Sat Apr 25 15:44:16 2020 +0200
1.2 +++ b/pkg/idl4re-examples/calc++/server.cc Sun Apr 26 18:24:46 2020 +0200
1.3 @@ -75,12 +75,9 @@
1.4
1.5 server_Calc obj;
1.6
1.7 - /* Server capability, incoming message and label. */
1.8 + /* Server capability. */
1.9
1.10 l4_cap_idx_t server;
1.11 - ipc_message_t msg;
1.12 - l4_umword_t label;
1.13 - Calc *target;
1.14
1.15 /* Register a server associating it with the given object. */
1.16
1.17 @@ -94,23 +91,8 @@
1.18
1.19 /* Wait for messages, dispatching to the handler. */
1.20
1.21 - while (1)
1.22 - {
1.23 - ipc_message_wait(&msg, &label);
1.24 -
1.25 - /* Ignore erroneous messages. */
1.26 -
1.27 - if (l4_ipc_error(msg.tag, l4_utcb()))
1.28 - continue;
1.29 -
1.30 - /* Handle messages for different server objects. */
1.31 -
1.32 - target = (Calc *) (label & ~3UL);
1.33 -
1.34 - /* Dispatch to the object. */
1.35 -
1.36 - handle_Calc(&msg, target);
1.37 - }
1.38 + ipc_server_loop(Calc_expected_items, &obj,
1.39 + (ipc_server_handler_type) handle_Calc);
1.40
1.41 return 0;
1.42 }
2.1 --- a/pkg/idl4re-examples/calc++/server_compound.cc Sat Apr 25 15:44:16 2020 +0200
2.2 +++ b/pkg/idl4re-examples/calc++/server_compound.cc Sun Apr 26 18:24:46 2020 +0200
2.3 @@ -86,12 +86,9 @@
2.4
2.5 server_CalcCounter obj;
2.6
2.7 - /* Server capability, incoming message and label. */
2.8 + /* Server capability. */
2.9
2.10 l4_cap_idx_t server;
2.11 - ipc_message_t msg;
2.12 - l4_umword_t label;
2.13 - CalcCounter *target;
2.14
2.15 /* Register a server associating it with the given object. */
2.16
2.17 @@ -105,23 +102,8 @@
2.18
2.19 /* Wait for messages, dispatching to the handler. */
2.20
2.21 - while (1)
2.22 - {
2.23 - ipc_message_wait(&msg, &label);
2.24 -
2.25 - /* Ignore erroneous messages. */
2.26 -
2.27 - if (l4_ipc_error(msg.tag, l4_utcb()))
2.28 - continue;
2.29 -
2.30 - /* Handle messages for different server objects. */
2.31 -
2.32 - target = (CalcCounter *) (label & ~3UL);
2.33 -
2.34 - /* Dispatch to the object. */
2.35 -
2.36 - handle_CalcCounter(&msg, target);
2.37 - }
2.38 + ipc_server_loop(CalcCounter_expected_items, &obj,
2.39 + (ipc_server_handler_type) handle_CalcCounter);
2.40
2.41 return 0;
2.42 }
3.1 --- a/pkg/idl4re-examples/calc/server.c Sat Apr 25 15:44:16 2020 +0200
3.2 +++ b/pkg/idl4re-examples/calc/server.c Sun Apr 26 18:24:46 2020 +0200
3.3 @@ -89,12 +89,9 @@
3.4 ref_Calc ref = {.ptr=0};
3.5 Calc obj = {.ref=ref, .iface=&server_iface_Calc};
3.6
3.7 - /* Server capability, incoming message and label. */
3.8 + /* Server capability. */
3.9
3.10 l4_cap_idx_t server;
3.11 - ipc_message_t msg;
3.12 - l4_umword_t label;
3.13 - Calc *target;
3.14
3.15 /* Register a server associating it with the given object. */
3.16
3.17 @@ -108,23 +105,8 @@
3.18
3.19 /* Wait for messages, dispatching to the handler. */
3.20
3.21 - while (1)
3.22 - {
3.23 - ipc_message_wait(&msg, &label);
3.24 -
3.25 - /* Ignore erroneous messages. */
3.26 -
3.27 - if (l4_ipc_error(msg.tag, l4_utcb()))
3.28 - continue;
3.29 -
3.30 - /* Handle messages for different server objects. */
3.31 -
3.32 - target = (Calc *) (label & ~3UL);
3.33 -
3.34 - /* Dispatch to the object. */
3.35 -
3.36 - handle_Calc(&msg, target);
3.37 - }
3.38 + ipc_server_loop(Calc_expected_items, &obj,
3.39 + (ipc_server_handler_type) handle_Calc);
3.40
3.41 return 0;
3.42 }
4.1 --- a/pkg/idl4re-examples/calc/server_compound.c Sat Apr 25 15:44:16 2020 +0200
4.2 +++ b/pkg/idl4re-examples/calc/server_compound.c Sun Apr 26 18:24:46 2020 +0200
4.3 @@ -115,12 +115,9 @@
4.4 ref_CalcCounter ref = {.ptr=&counter};
4.5 CalcCounter obj = {.ref=ref, .iface=&server_iface_CalcCounter};
4.6
4.7 - /* Server capability, incoming message and label. */
4.8 + /* Server capability. */
4.9
4.10 l4_cap_idx_t server;
4.11 - ipc_message_t msg;
4.12 - l4_umword_t label;
4.13 - CalcCounter *target;
4.14
4.15 /* Register a server associating it with the given object. */
4.16
4.17 @@ -134,23 +131,8 @@
4.18
4.19 /* Wait for messages, dispatching to the handler. */
4.20
4.21 - while (1)
4.22 - {
4.23 - ipc_message_wait(&msg, &label);
4.24 -
4.25 - /* Ignore erroneous messages. */
4.26 -
4.27 - if (l4_ipc_error(msg.tag, l4_utcb()))
4.28 - continue;
4.29 -
4.30 - /* Handle messages for different server objects. */
4.31 -
4.32 - target = (CalcCounter *) (label & ~3UL);
4.33 -
4.34 - /* Dispatch to the object. */
4.35 -
4.36 - handle_CalcCounter(&msg, target);
4.37 - }
4.38 + ipc_server_loop(CalcCounter_expected_items, &obj,
4.39 + (ipc_server_handler_type) handle_CalcCounter);
4.40
4.41 return 0;
4.42 }