# HG changeset patch # User Paul Boddie # Date 1679320323 -3600 # Node ID 89e3e3e0864bbaf278381137d7f66023e93e640b # Parent dc1441cbcb93883a238bea8be0c40576db8f64e4 Added a separate prepare operation distinct from starting any server. diff -r dc1441cbcb93 -r 89e3e3e0864b libipc/include/ipc/server.h --- a/libipc/include/ipc/server.h Mon Mar 20 09:23:22 2023 +0100 +++ b/libipc/include/ipc/server.h Mon Mar 20 14:52:03 2023 +0100 @@ -1,7 +1,8 @@ /* * Server binding/registration. * - * Copyright (C) 2018, 2019, 2020, 2021, 2022 Paul Boddie + * Copyright (C) 2018, 2019, 2020, 2021, 2022, + * 2023 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -173,6 +174,10 @@ void ipc_server_init_config(ipc_server_config_type *config); +/* Initialise but do not start a server using the given configuration. */ + +long ipc_server_prepare_config(ipc_server_config_type *config); + /* Initialise and start a server using the given configuration. */ long ipc_server_start_config(ipc_server_config_type *config); diff -r dc1441cbcb93 -r 89e3e3e0864b libipc/lib/src/server.c --- a/libipc/lib/src/server.c Mon Mar 20 09:23:22 2023 +0100 +++ b/libipc/lib/src/server.c Mon Mar 20 14:52:03 2023 +0100 @@ -206,7 +206,7 @@ config->thread = thread; config->config_thread = 1; - return ipc_server_start_config(config); + return ipc_server_prepare_config(config); } @@ -361,9 +361,9 @@ config->irq = L4_INVALID_CAP; } -/* Initialise and start a server using the given configuration. */ +/* Initialise but do not start a server using the given configuration. */ -long ipc_server_start_config(ipc_server_config_type *config) +long ipc_server_prepare_config(ipc_server_config_type *config) { long err; @@ -391,6 +391,18 @@ ipc_init_irq(config->irq); } + return L4_EOK; +} + +/* Initialise and start a server using the given configuration. */ + +long ipc_server_start_config(ipc_server_config_type *config) +{ + long err = ipc_server_prepare_config(config); + + if (err) + return err; + /* With a separate thread, return the last status value. Otherwise, invoke the main loop. */