L4Re/departure

Changeset

529:89e3e3e0864b
2023-03-20 Paul Boddie raw files shortlog changelog graph Added a separate prepare operation distinct from starting any server.
libipc/include/ipc/server.h (file) libipc/lib/src/server.c (file)
     1.1 --- a/libipc/include/ipc/server.h	Mon Mar 20 09:23:22 2023 +0100
     1.2 +++ b/libipc/include/ipc/server.h	Mon Mar 20 14:52:03 2023 +0100
     1.3 @@ -1,7 +1,8 @@
     1.4  /*
     1.5   * Server binding/registration.
     1.6   *
     1.7 - * Copyright (C) 2018, 2019, 2020, 2021, 2022 Paul Boddie <paul@boddie.org.uk>
     1.8 + * Copyright (C) 2018, 2019, 2020, 2021, 2022,
     1.9 + *               2023 Paul Boddie <paul@boddie.org.uk>
    1.10   *
    1.11   * This program is free software; you can redistribute it and/or
    1.12   * modify it under the terms of the GNU General Public License as
    1.13 @@ -173,6 +174,10 @@
    1.14  
    1.15  void ipc_server_init_config(ipc_server_config_type *config);
    1.16  
    1.17 +/* Initialise but do not start a server using the given configuration. */
    1.18 +
    1.19 +long ipc_server_prepare_config(ipc_server_config_type *config);
    1.20 +
    1.21  /* Initialise and start a server using the given configuration. */
    1.22  
    1.23  long ipc_server_start_config(ipc_server_config_type *config);
     2.1 --- a/libipc/lib/src/server.c	Mon Mar 20 09:23:22 2023 +0100
     2.2 +++ b/libipc/lib/src/server.c	Mon Mar 20 14:52:03 2023 +0100
     2.3 @@ -206,7 +206,7 @@
     2.4    config->thread = thread;
     2.5    config->config_thread = 1;
     2.6  
     2.7 -  return ipc_server_start_config(config);
     2.8 +  return ipc_server_prepare_config(config);
     2.9  }
    2.10  
    2.11  
    2.12 @@ -361,9 +361,9 @@
    2.13    config->irq = L4_INVALID_CAP;
    2.14  }
    2.15  
    2.16 -/* Initialise and start a server using the given configuration. */
    2.17 +/* Initialise but do not start a server using the given configuration. */
    2.18  
    2.19 -long ipc_server_start_config(ipc_server_config_type *config)
    2.20 +long ipc_server_prepare_config(ipc_server_config_type *config)
    2.21  {
    2.22    long err;
    2.23  
    2.24 @@ -391,6 +391,18 @@
    2.25      ipc_init_irq(config->irq);
    2.26    }
    2.27  
    2.28 +  return L4_EOK;
    2.29 +}
    2.30 +
    2.31 +/* Initialise and start a server using the given configuration. */
    2.32 +
    2.33 +long ipc_server_start_config(ipc_server_config_type *config)
    2.34 +{
    2.35 +  long err = ipc_server_prepare_config(config);
    2.36 +
    2.37 +  if (err)
    2.38 +    return err;
    2.39 +
    2.40    /* With a separate thread, return the last status value. Otherwise, invoke the
    2.41       main loop. */
    2.42