1.1 --- a/libipc/lib/src/server.c Tue Mar 15 17:36:39 2022 +0100
1.2 +++ b/libipc/lib/src/server.c Tue Mar 15 23:38:30 2022 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * Server binding/registration.
1.6 *
1.7 - * Copyright (C) 2018, 2019, 2020, 2021 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2018, 2019, 2020, 2021, 2022 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -174,6 +174,24 @@
1.13 return ipc_server_start_config(&config);
1.14 }
1.15
1.16 +/* Associate a new configuration with an existing server endpoint. */
1.17 +
1.18 +long _ipc_server_add_config(ipc_server_config_type *config, int expected_items,
1.19 + void *handler_obj, ipc_server_handler_type handler,
1.20 + l4_cap_idx_t thread)
1.21 +{
1.22 + ipc_server_init_config(config);
1.23 + config->expected_items = expected_items;
1.24 + config->handler = handler;
1.25 + config->handler_obj = handler_obj;
1.26 + config->thread = thread;
1.27 + config->config_thread = 1;
1.28 +
1.29 + return ipc_server_start_config(config);
1.30 +}
1.31 +
1.32 +
1.33 +
1.34 /* A server main loop handling endpoint deletion for an IPC gate dedicated to
1.35 a particular object within its own thread. */
1.36
1.37 @@ -283,11 +301,11 @@
1.38 }
1.39 }
1.40
1.41 -/* Discard any thread created but not initiated. */
1.42 +/* Discard any uninitiated thread. */
1.43
1.44 void ipc_server_discard_thread(ipc_server_config_type *config)
1.45 {
1.46 - if (config->new_thread && l4_is_valid_cap(config->thread))
1.47 + if (config->config_thread && l4_is_valid_cap(config->thread))
1.48 {
1.49 ipc_cap_free_um(config->thread);
1.50 config->thread = L4_INVALID_CAP;
1.51 @@ -312,9 +330,9 @@
1.52 config->handler = NULL;
1.53 config->finaliser = NULL;
1.54
1.55 - /* No new thread for the mainloop. */
1.56 + /* No separate thread for the main loop. */
1.57
1.58 - config->new_thread = 0;
1.59 + config->config_thread = 0;
1.60
1.61 /* Main thread by default with IPC gate to be allocated. */
1.62
1.63 @@ -353,11 +371,14 @@
1.64 return err;
1.65 }
1.66
1.67 - /* With a new thread, return the last status value. Otherwise, invoke the main
1.68 - loop. */
1.69 + /* With a separate thread, return the last status value. Otherwise, invoke the
1.70 + main loop. */
1.71
1.72 - if (config->new_thread)
1.73 + if (config->config_thread)
1.74 return L4_EOK;
1.75 else
1.76 return (long) ipc_server_start_mainloop(config);
1.77 }
1.78 +
1.79 +/* vim: tabstop=2 expandtab shiftwidth=2
1.80 +*/