1.1 --- a/libexec/lib/src/process_creating.cc Mon Apr 03 22:10:42 2023 +0200
1.2 +++ b/libexec/lib/src/process_creating.cc Tue Apr 04 23:11:00 2023 +0200
1.3 @@ -86,6 +86,7 @@
1.4 long ProcessCreating::init_external_pager(l4_cap_idx_t *pager)
1.5 {
1.6 _exec_pager = new ExternalPager(0, 10 * L4_PAGESIZE);
1.7 + _exec_pager->set_monitor(_monitor);
1.8
1.9 /* Initialise pager regions for the region mapper. */
1.10
1.11 @@ -119,13 +120,7 @@
1.12
1.13 /* Start the monitor in a separate thread. */
1.14
1.15 - long err = ResourceServer(_monitor).start_thread(monitor);
1.16 -
1.17 - if (err)
1.18 - return err;
1.19 -
1.20 - _exec_pager->set_monitor(_monitor);
1.21 - return L4_EOK;
1.22 + return ResourceServer(_monitor).start_thread(monitor);
1.23 }
1.24
1.25 /* Configure the environment for the task. */
1.26 @@ -369,10 +364,8 @@
1.27 program arguments, returning a reference to the process monitor as an object
1.28 for interacting with the process. */
1.29
1.30 -long ProcessCreating::start(int argc, const char *argv[], l4_cap_idx_t *process)
1.31 +long ProcessCreating::_start(int argc, const char *argv[], l4_cap_idx_t process)
1.32 {
1.33 - std::lock_guard<std::mutex> guard(_lock);
1.34 -
1.35 /* Open the program file, handling any error conditions. If successfully
1.36 opened, it will be closed when the process terminates. */
1.37
1.38 @@ -405,10 +398,6 @@
1.39 if (err)
1.40 return err;
1.41
1.42 - err = init_process_monitor(process);
1.43 - if (err)
1.44 - return err;
1.45 -
1.46 err = configure_task();
1.47 if (err)
1.48 return err;
1.49 @@ -421,7 +410,7 @@
1.50 if (err)
1.51 return err;
1.52
1.53 - err = start_program(*process, argc, argv);
1.54 + err = start_program(process, argc, argv);
1.55 if (err)
1.56 return err;
1.57
1.58 @@ -444,5 +433,21 @@
1.59 return L4_EOK;
1.60 }
1.61
1.62 +/* Start the given program, notifying the process monitor upon any error. */
1.63 +
1.64 +long ProcessCreating::start(int argc, const char *argv[], l4_cap_idx_t process)
1.65 +{
1.66 + std::lock_guard<std::mutex> guard(_lock);
1.67 +
1.68 + long err = _start(argc, argv, process);
1.69 +
1.70 + /* Communicate the error using the signal value. */
1.71 +
1.72 + if (err)
1.73 + _monitor->notify_all(NOTIFY_TASK_ERROR, (notify_values_t) {0, err});
1.74 +
1.75 + return err;
1.76 +}
1.77 +
1.78 /* vim: tabstop=2 expandtab shiftwidth=2
1.79 */