1.1 --- a/libexec/lib/src/process_monitor.cc Tue Dec 12 19:20:09 2023 +0100
1.2 +++ b/libexec/lib/src/process_monitor.cc Tue Dec 12 22:02:07 2023 +0100
1.3 @@ -51,13 +51,6 @@
1.4 void ProcessMonitor::close()
1.5 {
1.6 printf("Process monitor closing...\n");
1.7 -
1.8 - if (l4_is_valid_cap(_task))
1.9 - {
1.10 - ipc_unmap_capability(_task, _mapped_task);
1.11 - ipc_cap_free_um(_task);
1.12 - _task = L4_INVALID_CAP;
1.13 - }
1.14 }
1.15
1.16
1.17 @@ -94,8 +87,9 @@
1.18
1.19 void ProcessMonitor::pager_ended()
1.20 {
1.21 - /* Release the program thread and its reference to this object. This will
1.22 - cause this object to be closed. */
1.23 + /* Release the program thread and its reference to this object, leaving only
1.24 + the program initiator with a reference. When the initiator releases its
1.25 + reference, this object will be closed. */
1.26
1.27 if (l4_is_valid_cap(_thread))
1.28 {
1.29 @@ -105,6 +99,16 @@
1.30
1.31 ipc_unmap_capability(_task, _mapped_parent);
1.32 }
1.33 +
1.34 + /* Release the program task. This will release any capabilities that might be
1.35 + blocking the initiator, such as those involving pipes or streams. */
1.36 +
1.37 + if (l4_is_valid_cap(_task))
1.38 + {
1.39 + ipc_unmap_capability(_task, _mapped_task);
1.40 + ipc_cap_free_um(_task);
1.41 + _task = L4_INVALID_CAP;
1.42 + }
1.43 }
1.44
1.45
2.1 --- a/test_files/programs/dstest_exec_payload.c Tue Dec 12 19:20:09 2023 +0100
2.2 +++ b/test_files/programs/dstest_exec_payload.c Tue Dec 12 22:02:07 2023 +0100
2.3 @@ -51,8 +51,13 @@
2.4 }
2.5
2.6 client_write(output, "Terminating.\n", 13);
2.7 +
2.8 + /* NOTE: For inclusion in the C library. */
2.9 +
2.10 client_flush(output);
2.11 - client_close(output);
2.12 +
2.13 + /* NOTE: To test process completion, the output stream is left open. */
2.14 +
2.15 return 0;
2.16 }
2.17