1.1 --- a/libexec/lib/src/process_creator_resource.cc Tue Feb 28 22:35:25 2023 +0100
1.2 +++ b/libexec/lib/src/process_creator_resource.cc Tue Feb 28 22:40:02 2023 +0100
1.3 @@ -19,14 +19,14 @@
1.4 * Boston, MA 02110-1301, USA
1.5 */
1.6
1.7 +#include <fsserver/resource_server.h>
1.8 #include <systypes/fcntl.h>
1.9
1.10 +#include "opener_server.h"
1.11 #include "process_creating.h"
1.12 +#include "process_creator_context_resource.h"
1.13 #include "process_creator_resource.h"
1.14
1.15 -#include "notifier_client.h"
1.16 -#include "process_creator_server.h"
1.17 -
1.18
1.19
1.20 /* Support for creating processes. */
1.21 @@ -42,32 +42,32 @@
1.22
1.23 ipc_server_default_config_type ProcessCreatorResource::config()
1.24 {
1.25 - return config_ProcessCreator;
1.26 + return config_Opener;
1.27 }
1.28
1.29
1.30
1.31 /* ProcessCreator interface methods. */
1.32
1.33 -long ProcessCreatorResource::start(l4_cap_idx_t program, l4_cap_idx_t *process)
1.34 +long ProcessCreatorResource::start(int argc, const char *argv[], l4_cap_idx_t *process)
1.35 {
1.36 - file_t file;
1.37 -
1.38 - file_init(&file);
1.39 - file.ref = program;
1.40 -
1.41 - /* Obtain a distinct and usable file object. */
1.42 -
1.43 - file_t *program_file = client_reopen(&file, O_RDONLY);
1.44 -
1.45 - /* NOTE: To be replaced with the actual arguments, perhaps involving a
1.46 - context object. */
1.47 -
1.48 - const char *argv[] = {"<program>"};
1.49 + file_t *program_file = client_open(argv[0], O_RDONLY);
1.50
1.51 /* Start the new process, obtaining a reference to it. */
1.52
1.53 - return _creating.start(program_file, 1, argv, process);
1.54 + return _creating.start(program_file, argc, argv, process);
1.55 +}
1.56 +
1.57 +/* Opener interface methods. */
1.58 +
1.59 +long ProcessCreatorResource::context(l4_cap_idx_t *context)
1.60 +{
1.61 + ProcessCreatorContextResource *resource = new ProcessCreatorContextResource(this);
1.62 +
1.63 + /* Complete the initialisation and start a server in a new thread.
1.64 + If the thread does not start, the resource will be finalised. */
1.65 +
1.66 + return ResourceServer(resource).start_thread(context);
1.67 }
1.68
1.69 // vim: tabstop=4 expandtab shiftwidth=4