1.1 --- a/libexec/lib/src/process_creating.cc Sun Jun 02 23:15:39 2024 +0200
1.2 +++ b/libexec/lib/src/process_creating.cc Tue Jun 04 18:12:02 2024 +0200
1.3 @@ -294,7 +294,7 @@
1.4
1.5 long ProcessCreating::start_program(l4_cap_idx_t monitor, int argc,
1.6 const char *argv[], l4_cap_idx_t reader,
1.7 - l4_cap_idx_t writer)
1.8 + l4_cap_idx_t writer, l4_cap_idx_t error)
1.9 {
1.10 /* NOTE: Environment vector is currently not defined. */
1.11
1.12 @@ -337,11 +337,12 @@
1.13 l4_cap_idx_t pipeserver_cap = _process.allocate_cap();
1.14 l4_cap_idx_t pipeserver = l4re_env_get_cap(ENV_PIPE_SERVER_NAME);
1.15
1.16 - /* Also reserve capabilities for the reader and writer. If the reader or
1.17 - writer are invalid capabilities, these will not actually be transferred. */
1.18 + /* Also reserve capabilities for the reader and writers. If the reader or
1.19 + writers are invalid capabilities, these will not actually be transferred. */
1.20
1.21 l4_cap_idx_t reader_cap = _process.allocate_cap();
1.22 l4_cap_idx_t writer_cap = _process.allocate_cap();
1.23 + l4_cap_idx_t error_cap = _process.allocate_cap();
1.24
1.25 /* Define the capabilities to be mapped for the filesystem. */
1.26
1.27 @@ -351,6 +352,7 @@
1.28 {pipeserver_cap, pipeserver, L4_CAP_FPAGE_RWS, L4_FPAGE_C_OBJ_RIGHTS},
1.29 {reader_cap, reader, L4_CAP_FPAGE_RWS, L4_FPAGE_C_OBJ_RIGHTS},
1.30 {writer_cap, writer, L4_CAP_FPAGE_RWS, L4_FPAGE_C_OBJ_RIGHTS},
1.31 + {error_cap, error, L4_CAP_FPAGE_RWS, L4_FPAGE_C_OBJ_RIGHTS},
1.32 {L4_INVALID_CAP, L4_INVALID_CAP, 0, 0},
1.33 };
1.34
1.35 @@ -371,12 +373,16 @@
1.36 if (l4_is_invalid_cap(writer))
1.37 writer_cap = L4_INVALID_CAP;
1.38
1.39 + if (l4_is_invalid_cap(error))
1.40 + error_cap = L4_INVALID_CAP;
1.41 +
1.42 l4re_env_cap_entry_t program_init_caps[] = {
1.43 l4re_env_cap_entry_t(ENV_FILESYSTEM_SERVER_NAME, fsserver_cap, L4_CAP_FPAGE_RWS),
1.44 l4re_env_cap_entry_t(ENV_PROCESS_SERVER_NAME, prserver_cap, L4_CAP_FPAGE_RWS),
1.45 l4re_env_cap_entry_t(ENV_PIPE_SERVER_NAME, pipeserver_cap, L4_CAP_FPAGE_RWS),
1.46 l4re_env_cap_entry_t(ENV_INPUT_STREAM_NAME, reader_cap, L4_CAP_FPAGE_R),
1.47 l4re_env_cap_entry_t(ENV_OUTPUT_STREAM_NAME, writer_cap, L4_CAP_FPAGE_W),
1.48 + l4re_env_cap_entry_t(ENV_ERROR_STREAM_NAME, error_cap, L4_CAP_FPAGE_W),
1.49 l4re_env_cap_entry_t()
1.50 };
1.51
1.52 @@ -407,7 +413,8 @@
1.53 process. */
1.54
1.55 long ProcessCreating::_start(int argc, const char *argv[], l4_cap_idx_t reader,
1.56 - l4_cap_idx_t writer, l4_cap_idx_t process)
1.57 + l4_cap_idx_t writer, l4_cap_idx_t error,
1.58 + l4_cap_idx_t process)
1.59 {
1.60 /* Open the program file, handling any error conditions. If successfully
1.61 opened, it will be closed when the process terminates. */
1.62 @@ -453,7 +460,7 @@
1.63 if (err)
1.64 return err;
1.65
1.66 - err = start_program(process, argc, argv, reader, writer);
1.67 + err = start_program(process, argc, argv, reader, writer, error);
1.68 if (err)
1.69 return err;
1.70
1.71 @@ -479,16 +486,18 @@
1.72 /* Start the given program, notifying the process monitor upon any error. */
1.73
1.74 long ProcessCreating::start(int argc, const char *argv[], l4_cap_idx_t reader,
1.75 - l4_cap_idx_t writer, l4_cap_idx_t process)
1.76 + l4_cap_idx_t writer, l4_cap_idx_t error,
1.77 + l4_cap_idx_t process)
1.78 {
1.79 std::lock_guard<std::mutex> guard(_lock);
1.80
1.81 - long err = _start(argc, argv, reader, writer, process);
1.82 + long err = _start(argc, argv, reader, writer, error, process);
1.83
1.84 /* Discard the reader and writer since they will not be used in this task. */
1.85
1.86 ipc_cap_free_um(reader);
1.87 ipc_cap_free_um(writer);
1.88 + ipc_cap_free_um(error);
1.89
1.90 /* Communicate the error using the signal value. */
1.91