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