1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/conf/idl4re-examples/calc++.cfg Sun Jul 05 01:10:10 2020 +0200
1.3 @@ -0,0 +1,23 @@
1.4 +-- vim:set ft=lua:
1.5 +
1.6 +local L4 = require("L4");
1.7 +
1.8 +local l = L4.default_loader;
1.9 +
1.10 +local ipc = l:new_channel();
1.11 +
1.12 +l:start({
1.13 + caps = {
1.14 + server = ipc:svr(),
1.15 + },
1.16 + log = { "calc_server++", "y" },
1.17 + },
1.18 + "rom/calc_server++");
1.19 +
1.20 +l:start({
1.21 + caps = {
1.22 + server = ipc,
1.23 + },
1.24 + log = { "calc_client++", "g" },
1.25 + },
1.26 + "rom/calc_client++");
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/conf/idl4re-examples/calc++.list Sun Jul 05 01:10:10 2020 +0200
2.3 @@ -0,0 +1,24 @@
2.4 +entry calc++
2.5 +roottask moe rom/calc++.cfg
2.6 +module calc++.cfg
2.7 +module l4re
2.8 +module ned
2.9 +module calc_client++
2.10 +module calc_server++
2.11 +module lib4re-c.so
2.12 +module lib4re-c-util.so
2.13 +module lib4re.so
2.14 +module lib4re-util.so
2.15 +module libc_be_l4refile.so
2.16 +module libc_be_l4re.so
2.17 +module libc_be_socket_noop.so
2.18 +module libc_support_misc.so
2.19 +module libdl.so
2.20 +module libipc.so
2.21 +module libl4sys-direct.so
2.22 +module libl4sys.so
2.23 +module libl4util.so
2.24 +module libld-l4.so
2.25 +module libpthread.so
2.26 +module libsupc++.so
2.27 +module libuc_c.so
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/conf/idl4re-examples/calc.cfg Sun Jul 05 01:10:10 2020 +0200
3.3 @@ -0,0 +1,23 @@
3.4 +-- vim:set ft=lua:
3.5 +
3.6 +local L4 = require("L4");
3.7 +
3.8 +local l = L4.default_loader;
3.9 +
3.10 +local ipc = l:new_channel();
3.11 +
3.12 +l:start({
3.13 + caps = {
3.14 + server = ipc:svr(),
3.15 + },
3.16 + log = { "calc_server", "y" },
3.17 + },
3.18 + "rom/calc_server");
3.19 +
3.20 +l:start({
3.21 + caps = {
3.22 + server = ipc,
3.23 + },
3.24 + log = { "calc_client", "g" },
3.25 + },
3.26 + "rom/calc_client");
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/conf/idl4re-examples/calc.list Sun Jul 05 01:10:10 2020 +0200
4.3 @@ -0,0 +1,24 @@
4.4 +entry calc
4.5 +roottask moe rom/calc.cfg
4.6 +module calc.cfg
4.7 +module l4re
4.8 +module ned
4.9 +module calc_client
4.10 +module calc_server
4.11 +module lib4re-c.so
4.12 +module lib4re-c-util.so
4.13 +module lib4re.so
4.14 +module lib4re-util.so
4.15 +module libc_be_l4refile.so
4.16 +module libc_be_l4re.so
4.17 +module libc_be_socket_noop.so
4.18 +module libc_support_misc.so
4.19 +module libdl.so
4.20 +module libipc.so
4.21 +module libl4sys-direct.so
4.22 +module libl4sys.so
4.23 +module libl4util.so
4.24 +module libld-l4.so
4.25 +module libpthread.so
4.26 +module libsupc++.so
4.27 +module libuc_c.so
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/conf/idl4re-examples/calc_counter++.cfg Sun Jul 05 01:10:10 2020 +0200
5.3 @@ -0,0 +1,23 @@
5.4 +-- vim:set ft=lua:
5.5 +
5.6 +local L4 = require("L4");
5.7 +
5.8 +local l = L4.default_loader;
5.9 +
5.10 +local ipc = l:new_channel();
5.11 +
5.12 +l:start({
5.13 + caps = {
5.14 + server = ipc:svr(),
5.15 + },
5.16 + log = { "calc_counter_server++", "y" },
5.17 + },
5.18 + "rom/calc_counter_server++");
5.19 +
5.20 +l:start({
5.21 + caps = {
5.22 + server = ipc,
5.23 + },
5.24 + log = { "calc_counter_client++", "g" },
5.25 + },
5.26 + "rom/calc_counter_client++");
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/conf/idl4re-examples/calc_counter++.list Sun Jul 05 01:10:10 2020 +0200
6.3 @@ -0,0 +1,24 @@
6.4 +entry calc_counter++
6.5 +roottask moe rom/calc_counter++.cfg
6.6 +module calc_counter++.cfg
6.7 +module l4re
6.8 +module ned
6.9 +module calc_counter_client++
6.10 +module calc_counter_server++
6.11 +module lib4re-c.so
6.12 +module lib4re-c-util.so
6.13 +module lib4re.so
6.14 +module lib4re-util.so
6.15 +module libc_be_l4refile.so
6.16 +module libc_be_l4re.so
6.17 +module libc_be_socket_noop.so
6.18 +module libc_support_misc.so
6.19 +module libdl.so
6.20 +module libipc.so
6.21 +module libl4sys-direct.so
6.22 +module libl4sys.so
6.23 +module libl4util.so
6.24 +module libld-l4.so
6.25 +module libpthread.so
6.26 +module libsupc++.so
6.27 +module libuc_c.so
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/conf/idl4re-examples/calc_counter.cfg Sun Jul 05 01:10:10 2020 +0200
7.3 @@ -0,0 +1,23 @@
7.4 +-- vim:set ft=lua:
7.5 +
7.6 +local L4 = require("L4");
7.7 +
7.8 +local l = L4.default_loader;
7.9 +
7.10 +local ipc = l:new_channel();
7.11 +
7.12 +l:start({
7.13 + caps = {
7.14 + server = ipc:svr(),
7.15 + },
7.16 + log = { "calc_counter_server", "y" },
7.17 + },
7.18 + "rom/calc_counter_server");
7.19 +
7.20 +l:start({
7.21 + caps = {
7.22 + server = ipc,
7.23 + },
7.24 + log = { "calc_counter_client", "g" },
7.25 + },
7.26 + "rom/calc_counter_client");
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/conf/idl4re-examples/calc_counter.list Sun Jul 05 01:10:10 2020 +0200
8.3 @@ -0,0 +1,24 @@
8.4 +entry calc_counter
8.5 +roottask moe rom/calc_counter.cfg
8.6 +module calc_counter.cfg
8.7 +module l4re
8.8 +module ned
8.9 +module calc_counter_client
8.10 +module calc_counter_server
8.11 +module lib4re-c.so
8.12 +module lib4re-c-util.so
8.13 +module lib4re.so
8.14 +module lib4re-util.so
8.15 +module libc_be_l4refile.so
8.16 +module libc_be_l4re.so
8.17 +module libc_be_socket_noop.so
8.18 +module libc_support_misc.so
8.19 +module libdl.so
8.20 +module libipc.so
8.21 +module libl4sys-direct.so
8.22 +module libl4sys.so
8.23 +module libl4util.so
8.24 +module libld-l4.so
8.25 +module libpthread.so
8.26 +module libsupc++.so
8.27 +module libuc_c.so
9.1 --- a/dispatch.c Sun Jul 05 01:09:20 2020 +0200
9.2 +++ b/dispatch.c Sun Jul 05 01:10:10 2020 +0200
9.3 @@ -50,6 +50,10 @@
9.4 {
9.5 write_dispatcher_signature(iface->name, DEFINITION_ROLE, fp);
9.6
9.7 + /* Declare an error variable to support testing for already-sent messages. */
9.8 +
9.9 + fputs(" long err;\n\n", fp);
9.10 +
9.11 /* Interpret an operation indicator in the word data if a protocol applies to
9.12 the entire interface. */
9.13
10.1 --- a/pkg/idl4re-examples/calc++/Makefile Sun Jul 05 01:09:20 2020 +0200
10.2 +++ b/pkg/idl4re-examples/calc++/Makefile Sun Jul 05 01:10:10 2020 +0200
10.3 @@ -23,23 +23,38 @@
10.4 CLIENT_INTERFACES_CC = calc counter
10.5 SERVER_INTERFACES_CC = calc counter
10.6
10.7 -SRC_CC_calc_client++ = \
10.8 - $(call interfaces_to_client_cc,$(CLIENT_INTERFACES_CC)) \
10.9 - client.cc \
10.10 - calc_local.cc \
10.11 +# Generated and plain source files.
10.12 +
10.13 +CLIENT_INTERFACES_SRC_CC_calc_client++ = $(call interfaces_to_client_cc,calc)
10.14 +SERVER_INTERFACES_SRC_CC_calc_server++ = $(call interfaces_to_server_cc,calc)
10.15 +CLIENT_INTERFACES_SRC_CC_calc_counter_client++ = $(call interfaces_to_client_cc,calc counter)
10.16
10.17 -SRC_CC_calc_server++ = \
10.18 - $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC)) \
10.19 - server.cc \
10.20 +SERVER_INTERFACES_SRC_CC_calc_counter_server++ = \
10.21 + $(call interfaces_to_server_cc,calc counter) \
10.22 + $(call interfaces_to_server_cc,calc_counter)
10.23 +
10.24 +PLAIN_SRC_CC_calc_client++ = client.cc calc_local.cc
10.25 +PLAIN_SRC_CC_calc_server++ = server.cc
10.26 +PLAIN_SRC_CC_calc_counter_client++ = client_compound.cc
10.27 +PLAIN_SRC_CC_calc_counter_server++ = server_compound.cc
10.28
10.29 -SRC_CC_calc_counter_client++ = \
10.30 - $(call interfaces_to_client_cc,$(CLIENT_INTERFACES_CC)) \
10.31 - client_compound.cc \
10.32 +# Normal definitions.
10.33 +
10.34 +SRC_CC_calc_client++ = \
10.35 + $(CLIENT_INTERFACES_SRC_CC_calc_client++) \
10.36 + $(PLAIN_SRC_CC_calc_client++)
10.37
10.38 -SRC_CC_calc_counter_server++ = \
10.39 - $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC)) \
10.40 - $(call interfaces_to_server_cc,$(COMP_INTERFACES_CC)) \
10.41 - server_compound.cc \
10.42 +SRC_CC_calc_server++ = \
10.43 + $(SERVER_INTERFACES_SRC_CC_calc_server++) \
10.44 + $(PLAIN_SRC_CC_calc_server++)
10.45 +
10.46 +SRC_CC_calc_counter_client++ = \
10.47 + $(CLIENT_INTERFACES_SRC_CC_calc_counter_client++) \
10.48 + $(PLAIN_SRC_CC_calc_counter_client++)
10.49 +
10.50 +SRC_CC_calc_counter_server++ = \
10.51 + $(SERVER_INTERFACES_SRC_CC_calc_counter_server++) \
10.52 + $(PLAIN_SRC_CC_calc_counter_server++)
10.53
10.54 REQUIRES_LIBS = l4re_c-util libipc
10.55
10.56 @@ -47,3 +62,8 @@
10.57
10.58 include $(L4DIR)/mk/prog.mk
10.59 include $(IDL_MK_DIR)/interface_rules.mk
10.60 +
10.61 +$(PLAIN_SRC_CC_calc_client++): $(CLIENT_INTERFACES_SRC_CC_calc_client++)
10.62 +$(PLAIN_SRC_CC_calc_server++): $(SERVER_INTERFACES_SRC_CC_calc_server++)
10.63 +$(PLAIN_SRC_CC_calc_counter_client++): $(CLIENT_INTERFACES_SRC_CC_calc_counter_client++)
10.64 +$(PLAIN_SRC_CC_calc_counter_server++): $(SERVER_INTERFACES_SRC_CC_calc_counter_server++)
11.1 --- a/pkg/idl4re-examples/calc++/conf/calc++.cfg Sun Jul 05 01:09:20 2020 +0200
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,23 +0,0 @@
11.4 --- vim:set ft=lua:
11.5 -
11.6 -local L4 = require("L4");
11.7 -
11.8 -local l = L4.default_loader;
11.9 -
11.10 -local ipc = l:new_channel();
11.11 -
11.12 -l:start({
11.13 - caps = {
11.14 - server = ipc:svr(),
11.15 - },
11.16 - log = { "calc_server++", "y" },
11.17 - },
11.18 - "rom/calc_server++");
11.19 -
11.20 -l:start({
11.21 - caps = {
11.22 - server = ipc,
11.23 - },
11.24 - log = { "calc_client++", "g" },
11.25 - },
11.26 - "rom/calc_client++");
12.1 --- a/pkg/idl4re-examples/calc++/conf/calc++.list Sun Jul 05 01:09:20 2020 +0200
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,24 +0,0 @@
12.4 -entry calc++
12.5 -roottask moe rom/calc++.cfg
12.6 -module calc++.cfg
12.7 -module l4re
12.8 -module ned
12.9 -module calc_client++
12.10 -module calc_server++
12.11 -module lib4re-c.so
12.12 -module lib4re-c-util.so
12.13 -module lib4re.so
12.14 -module lib4re-util.so
12.15 -module libc_be_l4refile.so
12.16 -module libc_be_l4re.so
12.17 -module libc_be_socket_noop.so
12.18 -module libc_support_misc.so
12.19 -module libdl.so
12.20 -module libipc.so
12.21 -module libl4sys-direct.so
12.22 -module libl4sys.so
12.23 -module libl4util.so
12.24 -module libld-l4.so
12.25 -module libpthread.so
12.26 -module libsupc++.so
12.27 -module libuc_c.so
13.1 --- a/pkg/idl4re-examples/calc++/conf/calc_counter++.cfg Sun Jul 05 01:09:20 2020 +0200
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,23 +0,0 @@
13.4 --- vim:set ft=lua:
13.5 -
13.6 -local L4 = require("L4");
13.7 -
13.8 -local l = L4.default_loader;
13.9 -
13.10 -local ipc = l:new_channel();
13.11 -
13.12 -l:start({
13.13 - caps = {
13.14 - server = ipc:svr(),
13.15 - },
13.16 - log = { "calc_counter_server++", "y" },
13.17 - },
13.18 - "rom/calc_counter_server++");
13.19 -
13.20 -l:start({
13.21 - caps = {
13.22 - server = ipc,
13.23 - },
13.24 - log = { "calc_counter_client++", "g" },
13.25 - },
13.26 - "rom/calc_counter_client++");
14.1 --- a/pkg/idl4re-examples/calc++/conf/calc_counter++.list Sun Jul 05 01:09:20 2020 +0200
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,24 +0,0 @@
14.4 -entry calc_counter++
14.5 -roottask moe rom/calc_counter++.cfg
14.6 -module calc_counter++.cfg
14.7 -module l4re
14.8 -module ned
14.9 -module calc_counter_client++
14.10 -module calc_counter_server++
14.11 -module lib4re-c.so
14.12 -module lib4re-c-util.so
14.13 -module lib4re.so
14.14 -module lib4re-util.so
14.15 -module libc_be_l4refile.so
14.16 -module libc_be_l4re.so
14.17 -module libc_be_socket_noop.so
14.18 -module libc_support_misc.so
14.19 -module libdl.so
14.20 -module libipc.so
14.21 -module libl4sys-direct.so
14.22 -module libl4sys.so
14.23 -module libl4util.so
14.24 -module libld-l4.so
14.25 -module libpthread.so
14.26 -module libsupc++.so
14.27 -module libuc_c.so
15.1 --- a/pkg/idl4re-examples/calc/Makefile Sun Jul 05 01:09:20 2020 +0200
15.2 +++ b/pkg/idl4re-examples/calc/Makefile Sun Jul 05 01:10:10 2020 +0200
15.3 @@ -23,23 +23,38 @@
15.4 CLIENT_INTERFACES_C = calc counter
15.5 SERVER_INTERFACES_C = calc counter
15.6
15.7 +# Generated and plain source files.
15.8 +
15.9 +CLIENT_INTERFACES_SRC_C_calc_client = $(call interfaces_to_client_c,calc)
15.10 +CLIENT_INTERFACES_SRC_C_calc_counter_client = $(call interfaces_to_client_c,calc counter)
15.11 +SERVER_INTERFACES_SRC_C_calc_server = $(call interfaces_to_server_c,calc)
15.12 +
15.13 +SERVER_INTERFACES_SRC_C_calc_counter_server = \
15.14 + $(call interfaces_to_server_c,calc counter) \
15.15 + $(call interfaces_to_server_c,calc_counter)
15.16 +
15.17 +PLAIN_SRC_C_calc_client = client.c calc_local.c
15.18 +PLAIN_SRC_C_calc_server = server.c
15.19 +PLAIN_SRC_C_calc_counter_client = client_compound.c
15.20 +PLAIN_SRC_C_calc_counter_server = server_compound.c
15.21 +
15.22 +# Normal definitions.
15.23 +
15.24 SRC_C_calc_client = \
15.25 - $(call interfaces_to_client_c,$(CLIENT_INTERFACES_C)) \
15.26 - client.c \
15.27 - calc_local.c \
15.28 + $(CLIENT_INTERFACES_SRC_C_calc_client) \
15.29 + $(PLAIN_SRC_C_calc_client)
15.30
15.31 SRC_C_calc_server = \
15.32 - $(call interfaces_to_server_c,$(SERVER_INTERFACES_C)) \
15.33 - server.c \
15.34 + $(SERVER_INTERFACES_SRC_C_calc_server) \
15.35 + $(PLAIN_SRC_C_calc_server)
15.36
15.37 SRC_C_calc_counter_client = \
15.38 - $(call interfaces_to_client_c,$(CLIENT_INTERFACES_C)) \
15.39 - client_compound.c \
15.40 + $(CLIENT_INTERFACES_SRC_C_calc_counter_client) \
15.41 + $(PLAIN_SRC_C_calc_counter_client)
15.42
15.43 SRC_C_calc_counter_server = \
15.44 - $(call interfaces_to_server_c,$(SERVER_INTERFACES_C)) \
15.45 - $(call interfaces_to_server_c,$(COMP_INTERFACES_C)) \
15.46 - server_compound.c \
15.47 + $(SERVER_INTERFACES_SRC_C_calc_counter_server) \
15.48 + $(PLAIN_SRC_C_calc_counter_server)
15.49
15.50 REQUIRES_LIBS = l4re_c-util libipc
15.51
15.52 @@ -47,3 +62,8 @@
15.53
15.54 include $(L4DIR)/mk/prog.mk
15.55 include $(IDL_MK_DIR)/interface_rules.mk
15.56 +
15.57 +$(PLAIN_SRC_C_calc_client): $(CLIENT_INTERFACES_SRC_C_calc_client)
15.58 +$(PLAIN_SRC_C_calc_server): $(SERVER_INTERFACES_SRC_C_calc_server)
15.59 +$(PLAIN_SRC_C_calc_counter_client): $(CLIENT_INTERFACES_SRC_C_calc_counter_client)
15.60 +$(PLAIN_SRC_C_calc_counter_server): $(SERVER_INTERFACES_SRC_C_calc_counter_server)
16.1 --- a/pkg/idl4re-examples/calc/conf/calc.cfg Sun Jul 05 01:09:20 2020 +0200
16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
16.3 @@ -1,23 +0,0 @@
16.4 --- vim:set ft=lua:
16.5 -
16.6 -local L4 = require("L4");
16.7 -
16.8 -local l = L4.default_loader;
16.9 -
16.10 -local ipc = l:new_channel();
16.11 -
16.12 -l:start({
16.13 - caps = {
16.14 - server = ipc:svr(),
16.15 - },
16.16 - log = { "calc_server", "y" },
16.17 - },
16.18 - "rom/calc_server");
16.19 -
16.20 -l:start({
16.21 - caps = {
16.22 - server = ipc,
16.23 - },
16.24 - log = { "calc_client", "g" },
16.25 - },
16.26 - "rom/calc_client");
17.1 --- a/pkg/idl4re-examples/calc/conf/calc.list Sun Jul 05 01:09:20 2020 +0200
17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
17.3 @@ -1,24 +0,0 @@
17.4 -entry calc
17.5 -roottask moe rom/calc.cfg
17.6 -module calc.cfg
17.7 -module l4re
17.8 -module ned
17.9 -module calc_client
17.10 -module calc_server
17.11 -module lib4re-c.so
17.12 -module lib4re-c-util.so
17.13 -module lib4re.so
17.14 -module lib4re-util.so
17.15 -module libc_be_l4refile.so
17.16 -module libc_be_l4re.so
17.17 -module libc_be_socket_noop.so
17.18 -module libc_support_misc.so
17.19 -module libdl.so
17.20 -module libipc.so
17.21 -module libl4sys-direct.so
17.22 -module libl4sys.so
17.23 -module libl4util.so
17.24 -module libld-l4.so
17.25 -module libpthread.so
17.26 -module libsupc++.so
17.27 -module libuc_c.so
18.1 --- a/pkg/idl4re-examples/calc/conf/calc_counter.cfg Sun Jul 05 01:09:20 2020 +0200
18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
18.3 @@ -1,23 +0,0 @@
18.4 --- vim:set ft=lua:
18.5 -
18.6 -local L4 = require("L4");
18.7 -
18.8 -local l = L4.default_loader;
18.9 -
18.10 -local ipc = l:new_channel();
18.11 -
18.12 -l:start({
18.13 - caps = {
18.14 - server = ipc:svr(),
18.15 - },
18.16 - log = { "calc_counter_server", "y" },
18.17 - },
18.18 - "rom/calc_counter_server");
18.19 -
18.20 -l:start({
18.21 - caps = {
18.22 - server = ipc,
18.23 - },
18.24 - log = { "calc_counter_client", "g" },
18.25 - },
18.26 - "rom/calc_counter_client");
19.1 --- a/pkg/idl4re-examples/calc/conf/calc_counter.list Sun Jul 05 01:09:20 2020 +0200
19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
19.3 @@ -1,24 +0,0 @@
19.4 -entry calc_counter
19.5 -roottask moe rom/calc_counter.cfg
19.6 -module calc_counter.cfg
19.7 -module l4re
19.8 -module ned
19.9 -module calc_counter_client
19.10 -module calc_counter_server
19.11 -module lib4re-c.so
19.12 -module lib4re-c-util.so
19.13 -module lib4re.so
19.14 -module lib4re-util.so
19.15 -module libc_be_l4refile.so
19.16 -module libc_be_l4re.so
19.17 -module libc_be_socket_noop.so
19.18 -module libc_support_misc.so
19.19 -module libdl.so
19.20 -module libipc.so
19.21 -module libl4sys-direct.so
19.22 -module libl4sys.so
19.23 -module libl4util.so
19.24 -module libld-l4.so
19.25 -module libpthread.so
19.26 -module libsupc++.so
19.27 -module libuc_c.so
20.1 --- a/server.c Sun Jul 05 01:09:20 2020 +0200
20.2 +++ b/server.c Sun Jul 05 01:10:10 2020 +0200
20.3 @@ -1,7 +1,7 @@
20.4 /*
20.5 * Server code generation.
20.6 *
20.7 - * Copyright (C) 2019 Paul Boddie <paul@boddie.org.uk>
20.8 + * Copyright (C) 2019, 2020 Paul Boddie <paul@boddie.org.uk>
20.9 *
20.10 * This program is free software; you can redistribute it and/or
20.11 * modify it under the terms of the GNU General Public License as
20.12 @@ -44,12 +44,14 @@
20.13 FILE *fp, struct interface *iface)
20.14 {
20.15 if (have_attribute(sig->attributes, "completion"))
20.16 - {
20.17 write_server_initiation_signature(sig, role, fp, iface);
20.18 - write_server_completion_signature(sig, role, fp, iface);
20.19 - }
20.20 else
20.21 write_server_wrapper_signature(sig, role, fp, iface);
20.22 +
20.23 + /* Write the appropriate completion signature even for use by conventional
20.24 + operations. */
20.25 +
20.26 + write_server_completion_signature(sig, role, fp, iface);
20.27 }
20.28
20.29 /* Generic signature generation. */
20.30 @@ -88,13 +90,21 @@
20.31 {
20.32 char *opname = get_operation_name(iface, sig);
20.33
20.34 - /* Generate a signature featuring an initiator reference and only "out" and
20.35 - "inout" parameters. */
20.36 + /* Generate a signature featuring an initiator reference (for genuine
20.37 + decoupled completions) and only "out" and "inout" parameters. */
20.38 +
20.39 + int completion = have_attribute(sig->attributes, "completion");
20.40
20.41 - fprintf(fp, server_completion_function_signature_prologue, opname, iface->name);
20.42 + char *prologue = completion ?
20.43 + server_completion_function_signature_prologue :
20.44 + server_completion_optional_function_signature_prologue;
20.45 +
20.46 + fprintf(fp, prologue, opname, iface->name);
20.47 +
20.48 + /* Continue from the initial endpoint parameter if a genuine completion. */
20.49
20.50 write_parameters(sig->parameters, fp, SIGNATURE_ROLE, COMPLETION_ROLE,
20.51 - OUT_PARAMETER, 1);
20.52 + OUT_PARAMETER, completion);
20.53
20.54 fputs(")", fp);
20.55 fputs(get_signature_terminator(role), fp);
20.56 @@ -113,10 +123,6 @@
20.57 write_server_initiation_signature(sig, DEFINITION_ROLE, fp, iface);
20.58 write_server_initiation_function_body(sig->parameters, fp, iface, sig);
20.59 fputs(END_FUNCTION, fp);
20.60 -
20.61 - write_server_completion_signature(sig, DEFINITION_ROLE, fp, iface);
20.62 - write_server_completion_function_body(sig->parameters, fp, iface, sig);
20.63 - fputs(END_FUNCTION, fp);
20.64 }
20.65 else
20.66 {
20.67 @@ -124,6 +130,13 @@
20.68 write_server_wrapper_function_body(sig->parameters, fp, iface, sig);
20.69 fputs(END_FUNCTION, fp);
20.70 }
20.71 +
20.72 + /* Write the appropriate completion function even for use by conventional
20.73 + operations. */
20.74 +
20.75 + write_server_completion_signature(sig, DEFINITION_ROLE, fp, iface);
20.76 + write_server_completion_function_body(sig->parameters, fp, iface, sig);
20.77 + fputs(END_FUNCTION, fp);
20.78 }
20.79
20.80 /* Generate a function body corresponding to an operation for server use. */
20.81 @@ -250,10 +263,16 @@
20.82
20.83 write_output_initialisation(param, fp, opname, output_words, output_items, COMPLETION_ROLE);
20.84
20.85 - /* Send the response.
20.86 + /* Send a response as a new message to the given endpoint.
20.87 NOTE: The label 0 is employed but an error condition could be communicated. */
20.88
20.89 - fprintf(fp, server_completion_function_body_epilogue, "0", "_endp");
20.90 + if (have_attribute(sig->attributes, "completion"))
20.91 + fprintf(fp, server_completion_function_body_epilogue, "0", "_endp");
20.92 +
20.93 + /* Send a plain reply for optional/coupled completions. */
20.94 +
20.95 + else
20.96 + fputs(server_completion_optional_function_body_epilogue, fp);
20.97
20.98 /* Free allocated strings. */
20.99
21.1 --- a/templates.h Sun Jul 05 01:09:20 2020 +0200
21.2 +++ b/templates.h Sun Jul 05 01:10:10 2020 +0200
21.3 @@ -195,6 +195,9 @@
21.4 #define server_completion_function_signature_prologue \
21.5 "\nlong complete_%s(l4_cap_idx_t _endp"
21.6
21.7 +#define server_completion_optional_function_signature_prologue \
21.8 +"\nlong complete_%s("
21.9 +
21.10 #define server_completion_function_body_prologue \
21.11 " ipc_message_t msg;\n"
21.12
21.13 @@ -202,6 +205,10 @@
21.14 "\n ipc_message_send(&msg, %s, %s);\n\n" \
21.15 " return l4_error(msg.tag);\n"
21.16
21.17 +#define server_completion_optional_function_body_epilogue \
21.18 +"\n ipc_message_reply(&msg);\n\n" \
21.19 + " return l4_error(msg.tag);\n"
21.20 +
21.21 #define server_initiation_function_body_epilogue \
21.22 "\n ipc_message_prepare(msg);\n\n" \
21.23 " return L4_EOK;\n"
21.24 @@ -317,8 +324,10 @@
21.25
21.26 #define dispatch_function_reply_wrapper_case \
21.27 " case %s:\n" \
21.28 -" ipc_message_send_error(msg, %s_%s(msg, %s));\n" \
21.29 -" ipc_message_reply(msg);\n" \
21.30 +" err = %s_%s(msg, %s);\n" \
21.31 +" ipc_message_send_error(msg, err != IPC_MESSAGE_SENT ? err : L4_EOK);\n" \
21.32 +" if (err != IPC_MESSAGE_SENT)\n" \
21.33 +" ipc_message_reply(msg);\n" \
21.34 " break;\n\n"
21.35
21.36 /* Tokens. */