1.1 --- a/libexec/lib/src/process_creating.cc Mon Dec 11 19:17:25 2023 +0100
1.2 +++ b/libexec/lib/src/process_creating.cc Mon Dec 11 19:23:39 2023 +0100
1.3 @@ -283,7 +283,8 @@
1.4 /* Configure a thread for a program, populate its stack, and start the
1.5 thread. */
1.6
1.7 -long ProcessCreating::start_program(l4_cap_idx_t monitor, int argc, const char *argv[])
1.8 +long ProcessCreating::start_program(l4_cap_idx_t monitor, int argc,
1.9 + const char *argv[], l4_cap_idx_t writer)
1.10 {
1.11 /* NOTE: Environment vector is currently not defined. */
1.12
1.13 @@ -316,10 +317,15 @@
1.14 l4_cap_idx_t fsserver_cap = _process.allocate_cap();
1.15 l4_cap_idx_t fsserver = l4re_env_get_cap(ENV_FILESYSTEM_SERVER_NAME);
1.16
1.17 + /* Also reserve a capability for the writer. */
1.18 +
1.19 + l4_cap_idx_t writer_cap = _process.allocate_cap();
1.20 +
1.21 /* Define the capabilities to be mapped for the filesystem. */
1.22
1.23 struct ipc_mapped_cap program_mapped_caps[] = {
1.24 {fsserver_cap, fsserver, L4_CAP_FPAGE_RWS, L4_FPAGE_C_OBJ_RIGHTS},
1.25 + {writer_cap, writer, L4_CAP_FPAGE_RWS, L4_FPAGE_C_OBJ_RIGHTS},
1.26 {0, L4_INVALID_CAP, 0, 0},
1.27 };
1.28
1.29 @@ -336,6 +342,7 @@
1.30
1.31 l4re_env_cap_entry_t program_init_caps[] = {
1.32 l4re_env_cap_entry_t(ENV_FILESYSTEM_SERVER_NAME, fsserver_cap, L4_CAP_FPAGE_RWS),
1.33 + l4re_env_cap_entry_t(ENV_OUTPUT_STREAM_NAME, writer_cap, L4_CAP_FPAGE_W),
1.34 l4re_env_cap_entry_t()
1.35 };
1.36
1.37 @@ -361,10 +368,12 @@
1.38 }
1.39
1.40 /* Start a new process for the payload indicated by the first of the given
1.41 - program arguments, returning a reference to the process monitor as an object
1.42 - for interacting with the process. */
1.43 + program arguments, employing the given writer pipe, and returning a
1.44 + reference to the process monitor as an object for interacting with the
1.45 + process. */
1.46
1.47 -long ProcessCreating::_start(int argc, const char *argv[], l4_cap_idx_t process)
1.48 +long ProcessCreating::_start(int argc, const char *argv[], l4_cap_idx_t writer,
1.49 + l4_cap_idx_t process)
1.50 {
1.51 /* Open the program file, handling any error conditions. If successfully
1.52 opened, it will be closed when the process terminates. */
1.53 @@ -410,7 +419,7 @@
1.54 if (err)
1.55 return err;
1.56
1.57 - err = start_program(process, argc, argv);
1.58 + err = start_program(process, argc, argv, writer);
1.59 if (err)
1.60 return err;
1.61
1.62 @@ -435,11 +444,12 @@
1.63
1.64 /* Start the given program, notifying the process monitor upon any error. */
1.65
1.66 -long ProcessCreating::start(int argc, const char *argv[], l4_cap_idx_t process)
1.67 +long ProcessCreating::start(int argc, const char *argv[], l4_cap_idx_t writer,
1.68 + l4_cap_idx_t process)
1.69 {
1.70 std::lock_guard<std::mutex> guard(_lock);
1.71
1.72 - long err = _start(argc, argv, process);
1.73 + long err = _start(argc, argv, writer, process);
1.74
1.75 /* Communicate the error using the signal value. */
1.76