1.1 --- a/tests/dstest_exec.cc Sat Feb 18 22:48:39 2023 +0100
1.2 +++ b/tests/dstest_exec.cc Thu Feb 23 23:49:26 2023 +0100
1.3 @@ -23,7 +23,8 @@
1.4 #include <l4/sys/err.h>
1.5 #include <l4/util/util.h>
1.6
1.7 -#include <exec/process_creator.h>
1.8 +#include <fsclient/client.h>
1.9 +#include <fsclient/process.h>
1.10 #include <systypes/fcntl.h>
1.11 #include <systypes/format.h>
1.12
1.13 @@ -31,34 +32,18 @@
1.14
1.15
1.16
1.17 -class local_Notifier : public Notifier
1.18 -{
1.19 -public:
1.20 - long notify(notify_flags_t flags, notify_values_t values)
1.21 - {
1.22 - printf("Notified with flags: %" pFMTnotify_flags "x\n", flags);
1.23 - printf("Notified with values: %ld, %ld\n", values.sig, values.val);
1.24 -
1.25 - return L4_EOK;
1.26 - }
1.27 -};
1.28 -
1.29 -
1.30 -
1.31 int main(int argc, char *argv[])
1.32 {
1.33 long err;
1.34
1.35 - if (argc < 3)
1.36 + if (argc < 2)
1.37 {
1.38 - printf("Need a region mapper and the actual program to run.\n");
1.39 + printf("Need the program to run.\n");
1.40 return 1;
1.41 }
1.42
1.43 - char *rm_filename = argv[1];
1.44 - char *program_filename = argv[2];
1.45 + char *program_filename = argv[1];
1.46
1.47 - ProcessCreator creator(rm_filename);
1.48 file_t *program_file = client_open(program_filename, O_RDONLY);
1.49
1.50 if (!client_opened(program_file))
1.51 @@ -67,10 +52,18 @@
1.52 return 1;
1.53 }
1.54
1.55 - local_Notifier notifier;
1.56 + /* Create a new process structure and obtain the common notifier. */
1.57 +
1.58 + process_t *process = process_new();
1.59 + process_notifier_t *notifier = process_notify_task();
1.60
1.61 - creator.set_notifier(¬ifier);
1.62 - err = creator.start(program_file, argc - 2, (const char **) argv + 2);
1.63 + /* Start a process for the given program, specifying a notifier from which an
1.64 + endpoint will be obtained for notifications. */
1.65 +
1.66 + err = process_start(process, program_file, notifier);
1.67 +
1.68 + /* NOTE: Need to be able to send arguments, which would be sent via a context,
1.69 + although capabilities could be sent via arguments. */
1.70
1.71 if (err)
1.72 {
1.73 @@ -79,17 +72,18 @@
1.74 }
1.75
1.76 printf("Finished program initiation.\n");
1.77 - printf("End of test.\n");
1.78 +
1.79 + /* Wait for a signal from the process. */
1.80 +
1.81 + err = process_notify_wait_process(process, notifier);
1.82
1.83 - /* NOTE: Should be able to obtain a notification for when the program
1.84 - finishes, which might be done using a capability deletion IRQ.
1.85 - Eventually, this program will operate as a server, invoking new
1.86 - programs and handling termination. This test would then merely
1.87 - involve the invocation of a utility function. */
1.88 + notify_flags_t flags = process_notifications(process);
1.89 + notify_values_t values = process_notification_values(process);
1.90
1.91 - while (1)
1.92 - l4_sleep_forever();
1.93 + printf("Notified with flags: %" pFMTnotify_flags "x\n", flags);
1.94 + printf("Notified with values: %ld, %ld\n", values.sig, values.val);
1.95
1.96 + printf("End of test.\n");
1.97 return 0;
1.98 }
1.99