1.1 --- a/libexec/include/exec/external_pager.h Thu Feb 23 23:49:26 2023 +0100 1.2 +++ b/libexec/include/exec/external_pager.h Sat Feb 25 18:10:13 2023 +0100 1.3 @@ -22,6 +22,7 @@ 1.4 #pragma once 1.5 1.6 #include <exec/pager.h> 1.7 +#include <fsserver/notification.h> 1.8 1.9 #include "notifier_interface.h" 1.10 #include "parent_pager_object_interface.h" 1.11 @@ -30,10 +31,11 @@ 1.12 1.13 /* A simple system pager also acting as a region mapper. */ 1.14 1.15 -class ExternalPager : public ExecPager, public ParentPagerObject 1.16 +class ExternalPager : public ExecPager, public ParentPagerObject, 1.17 + public NotificationSupport 1.18 { 1.19 protected: 1.20 - Notifier *_notifier = NULL; 1.21 + unsigned int _endpoint; 1.22 1.23 public: 1.24 explicit ExternalPager(address_t start = 0, address_t end = 0); 1.25 @@ -57,8 +59,11 @@ 1.26 1.27 /* Notification methods. */ 1.28 1.29 - virtual void set_notifier(Notifier *notifier) 1.30 - { _notifier = notifier; } 1.31 + virtual long subscribe(l4_cap_idx_t notifier, notify_flags_t flags) 1.32 + { return NotificationSupport::subscribe(notifier, flags, this, &_endpoint); } 1.33 + 1.34 + virtual long unsubscribe() 1.35 + { NotificationSupport::unsubscribe(_endpoint, this); return L4_EOK; } 1.36 }; 1.37 1.38 /* vim: tabstop=2 expandtab shiftwidth=2
2.1 --- a/libexec/include/exec/process_creating.h Thu Feb 23 23:49:26 2023 +0100 2.2 +++ b/libexec/include/exec/process_creating.h Sat Feb 25 18:10:13 2023 +0100 2.3 @@ -84,7 +84,7 @@ 2.4 2.5 virtual long start(file_t *file, int argc, const char *argv[]); 2.6 2.7 - virtual void set_notifier(Notifier *notifier); 2.8 + virtual l4_cap_idx_t get_pager(); 2.9 }; 2.10 2.11 /* vim: tabstop=2 expandtab shiftwidth=2
3.1 --- a/libexec/include/exec/process_creator_resource.h Thu Feb 23 23:49:26 2023 +0100 3.2 +++ b/libexec/include/exec/process_creator_resource.h Sat Feb 25 18:10:13 2023 +0100 3.3 @@ -47,7 +47,7 @@ 3.4 3.5 /* Process creator interface methods. */ 3.6 3.7 - virtual long start(l4_cap_idx_t program, l4_cap_idx_t notifier); 3.8 + virtual long start(l4_cap_idx_t program, l4_cap_idx_t *process); 3.9 }; 3.10 3.11 /* vim: tabstop=2 expandtab shiftwidth=2
4.1 --- a/libexec/lib/src/external_pager.cc Thu Feb 23 23:49:26 2023 +0100 4.2 +++ b/libexec/lib/src/external_pager.cc Sat Feb 25 18:10:13 2023 +0100 4.3 @@ -39,7 +39,7 @@ 4.4 /* A simple system pager also acting as a region mapper. */ 4.5 4.6 ExternalPager::ExternalPager(address_t start, address_t end) 4.7 -: ExecPager(start, end) 4.8 +: ExecPager(start, end), NotificationSupport() 4.9 { 4.10 } 4.11 4.12 @@ -163,8 +163,7 @@ 4.13 4.14 long ExternalPager::signal(unsigned long sig, unsigned long val) 4.15 { 4.16 - if (_notifier != NULL) 4.17 - _notifier->notify(NOTIFY_TASK_SIGNAL, (notify_values_t) {sig, val}); 4.18 + notify_all(NOTIFY_TASK_SIGNAL, (notify_values_t) {sig, val}); 4.19 4.20 return L4_EOK; 4.21 }
5.1 --- a/libexec/lib/src/process_creating.cc Thu Feb 23 23:49:26 2023 +0100 5.2 +++ b/libexec/lib/src/process_creating.cc Sat Feb 25 18:10:13 2023 +0100 5.3 @@ -313,11 +313,11 @@ 5.4 return start_program(argc, argv); 5.5 } 5.6 5.7 -/* Set the given notifier on the system-level pager for a process. */ 5.8 +/* Get a reference to the system-level pager for a process. */ 5.9 5.10 -void ProcessCreating::set_notifier(Notifier *notifier) 5.11 +l4_cap_idx_t ProcessCreating::get_pager() 5.12 { 5.13 - _exec_pager.set_notifier(notifier); 5.14 + return _config.server; 5.15 } 5.16 5.17 /* vim: tabstop=2 expandtab shiftwidth=2
6.1 --- a/libexec/lib/src/process_creator_resource.cc Thu Feb 23 23:49:26 2023 +0100 6.2 +++ b/libexec/lib/src/process_creator_resource.cc Sat Feb 25 18:10:13 2023 +0100 6.3 @@ -49,7 +49,7 @@ 6.4 6.5 /* ProcessCreator interface methods. */ 6.6 6.7 -long ProcessCreatorResource::start(l4_cap_idx_t program, l4_cap_idx_t notifier) 6.8 +long ProcessCreatorResource::start(l4_cap_idx_t program, l4_cap_idx_t *process) 6.9 { 6.10 file_t file; 6.11 6.12 @@ -70,11 +70,9 @@ 6.13 if (err) 6.14 return err; 6.15 6.16 - /* NOTE: To be managed properly. */ 6.17 + /* Obtain a reference to the pager to interact with the process. */ 6.18 6.19 - client_Notifier *n = new client_Notifier(notifier); 6.20 - 6.21 - set_notifier(n); 6.22 + *process = get_pager(); 6.23 6.24 return L4_EOK; 6.25 }
7.1 --- a/libfsclient/include/fsclient/process.h Thu Feb 23 23:49:26 2023 +0100 7.2 +++ b/libfsclient/include/fsclient/process.h Sat Feb 25 18:10:13 2023 +0100 7.3 @@ -58,7 +58,7 @@ 7.4 7.5 process_t *process_new(); 7.6 void process_init(process_t *process); 7.7 -long process_start(process_t *process, file_t *file, process_notifier_t *notifier); 7.8 +long process_start(process_t *process, file_t *file); 7.9 7.10 /* Notification support. */ 7.11 7.12 @@ -68,8 +68,8 @@ 7.13 void process_notify_close(process_notifier_t *notifier); 7.14 process_notifier_t *process_notify_local(); 7.15 process_notifier_t *process_notify_task(); 7.16 -long process_notify_get_endpoint(process_t *process, process_notifier_t *notifier, l4_cap_idx_t *endpoint); 7.17 -long process_notify_remove_endpoint(process_t *process, process_notifier_t *notifier, l4_cap_idx_t endpoint); 7.18 +long process_notify_subscribe(process_t *process, notify_flags_t flags, process_notifier_t *notifier); 7.19 +long process_notify_unsubscribe(process_t *process, process_notifier_t *notifier); 7.20 long process_notify_wait_process(process_t *process, process_notifier_t *notifier); 7.21 long process_notify_wait_processes(process_t **process, process_notifier_t *notifier); 7.22
8.1 --- a/libfsclient/lib/src/process.cc Thu Feb 23 23:49:26 2023 +0100 8.2 +++ b/libfsclient/lib/src/process.cc Sat Feb 25 18:10:13 2023 +0100 8.3 @@ -62,28 +62,20 @@ 8.4 NOTE: This does not yet communicate arguments or obtain input/output 8.5 pipes. */ 8.6 8.7 -long process_start(process_t *process, file_t *file, process_notifier_t *notifier) 8.8 +long process_start(process_t *process, file_t *file) 8.9 { 8.10 l4_cap_idx_t server = l4re_env_get_cap("pserver"); 8.11 8.12 if (l4_is_invalid_cap(server)) 8.13 return -L4_ENOMEM; 8.14 8.15 - /* Obtain a notification endpoint. */ 8.16 - 8.17 - l4_cap_idx_t endpoint; 8.18 - long err = process_notify_get_endpoint(process, notifier, &endpoint); 8.19 - 8.20 - if (err) 8.21 - return err; 8.22 - 8.23 /* Obtain a client for the process creator. */ 8.24 8.25 client_ProcessCreator creator(server); 8.26 8.27 - /* Start the process, supplying the given endpoint. */ 8.28 + /* Start the process, obtaining a reference to it. */ 8.29 8.30 - return creator.start(file->ref, endpoint); 8.31 + return creator.start(file->ref, &process->ref); 8.32 } 8.33 8.34 8.35 @@ -149,16 +141,16 @@ 8.36 8.37 /* Subscribe to notification events on a process. */ 8.38 8.39 -long process_notify_get_endpoint(process_t *process, process_notifier_t *notifier, l4_cap_idx_t *endpoint) 8.40 +long process_notify_subscribe(process_t *process, notify_flags_t flags, process_notifier_t *notifier) 8.41 { 8.42 - return notifier->obj->get_endpoint(process_notifiable(process), endpoint, true); 8.43 + return notifier->obj->subscribe(process_notifiable(process), flags); 8.44 } 8.45 8.46 /* Unsubscribe from notification events on a process. */ 8.47 8.48 -long process_notify_remove_endpoint(process_t *process, process_notifier_t *notifier, l4_cap_idx_t endpoint) 8.49 +long process_notify_unsubscribe(process_t *process, process_notifier_t *notifier) 8.50 { 8.51 - return notifier->obj->remove_endpoint(process_notifiable(process), endpoint); 8.52 + return notifier->obj->unsubscribe(process_notifiable(process)); 8.53 } 8.54 8.55 /* Wait for a notification event on a process. */ 8.56 @@ -168,10 +160,11 @@ 8.57 SpecificObjectNotifier *specific_notifier = dynamic_cast<SpecificObjectNotifier *>(notifier->obj); 8.58 long err = specific_notifier->wait_object(process_notifiable(process)); 8.59 8.60 - /* Unsubscribe if a closure notification has been received. */ 8.61 + /* Unsubscribe if a termination notification has been received. */ 8.62 8.63 - //if (!err && (process->notifiable.notifications & NOTIFY_PEER_CLOSED)) 8.64 - //process_notify_unsubscribe(process, notifier); 8.65 + if (!err && (process->notifiable.notifications & NOTIFY_TASK_SIGNAL) && 8.66 + (process->notifiable.values.sig == 0)) 8.67 + process_notify_unsubscribe(process, notifier); 8.68 8.69 return err; 8.70 } 8.71 @@ -186,10 +179,11 @@ 8.72 8.73 *process = (process_t *) notifiable->base; 8.74 8.75 - /* Unsubscribe if a closure notification has been received. */ 8.76 + /* Unsubscribe if a termination notification has been received. */ 8.77 8.78 - //if (!err && ((*file)->notifiable.notifications & NOTIFY_PEER_CLOSED)) 8.79 - //file_notify_unsubscribe(*file, notifier); 8.80 + if (!err && ((*process)->notifiable.notifications & NOTIFY_TASK_SIGNAL) && 8.81 + ((*process)->notifiable.values.sig == 0)) 8.82 + process_notify_unsubscribe(*process, notifier); 8.83 8.84 return err; 8.85 }
9.1 --- a/libfsserver/include/fsserver/notification.h Thu Feb 23 23:49:26 2023 +0100 9.2 +++ b/libfsserver/include/fsserver/notification.h Sat Feb 25 18:10:13 2023 +0100 9.3 @@ -1,7 +1,7 @@ 9.4 /* 9.5 * Notification support. 9.6 * 9.7 - * Copyright (C) 2021, 2022 Paul Boddie <paul@boddie.org.uk> 9.8 + * Copyright (C) 2021, 2022, 2023 Paul Boddie <paul@boddie.org.uk> 9.9 * 9.10 * This program is free software; you can redistribute it and/or 9.11 * modify it under the terms of the GNU General Public License as 9.12 @@ -45,7 +45,14 @@ 9.13 { 9.14 public: 9.15 NotifierSet notifiers; 9.16 - notify_flags_t flags = 0, deferred = 0; 9.17 + 9.18 + /* Notification flag mask, deferred flags. */ 9.19 + 9.20 + notify_flags_t flags = 0, deferred_flags = 0; 9.21 + 9.22 + /* Deferred values. */ 9.23 + 9.24 + notify_values_t deferred_values = NOTIFY_VALUES_NULL; 9.25 }; 9.26 9.27 typedef std::vector<NotificationEndpoint> NotificationEndpointList; 9.28 @@ -74,11 +81,13 @@ 9.29 9.30 /* Deferred notifications for new endpoints. */ 9.31 9.32 - notify_flags_t _deferred = 0; 9.33 + notify_flags_t _deferred_flags = 0; 9.34 + notify_values_t _deferred_values = NOTIFY_VALUES_NULL; 9.35 9.36 virtual void release_notifiers(); 9.37 9.38 - virtual void _notify(unsigned int endpoint, notify_flags_t flags); 9.39 + virtual void _notify(unsigned int endpoint, notify_flags_t flags, 9.40 + notify_values_t values); 9.41 9.42 virtual long _subscribe(unsigned int endpoint, l4_cap_idx_t notifier, 9.43 notify_flags_t flags, void *subscriber); 9.44 @@ -90,11 +99,13 @@ 9.45 9.46 virtual ~NotificationSupport(); 9.47 9.48 - virtual void notify(unsigned int endpoint, notify_flags_t flags); 9.49 + virtual void notify(unsigned int endpoint, notify_flags_t flags, 9.50 + notify_values_t values); 9.51 9.52 - virtual void notify_all(notify_flags_t flags); 9.53 + virtual void notify_all(notify_flags_t flags, notify_values_t values); 9.54 9.55 - virtual void notify_others(unsigned int endpoint, notify_flags_t flags); 9.56 + virtual void notify_others(unsigned int endpoint, notify_flags_t flags, 9.57 + notify_values_t values); 9.58 9.59 virtual long subscribe(l4_cap_idx_t notifier, notify_flags_t flags, 9.60 void *subscriber, unsigned int *endpoint_number);
10.1 --- a/libfsserver/lib/files/file_pager.cc Thu Feb 23 23:49:26 2023 +0100 10.2 +++ b/libfsserver/lib/files/file_pager.cc Sat Feb 25 18:10:13 2023 +0100 10.3 @@ -52,7 +52,7 @@ 10.4 { 10.5 /* Notify other users of the file and unsubscribe. */ 10.6 10.7 - _provider->notify_others(_endpoint, NOTIFY_PEER_CLOSED); 10.8 + _provider->notify_others(_endpoint, NOTIFY_PEER_CLOSED, NOTIFY_VALUES_NULL); 10.9 unsubscribe(); 10.10 10.11 /* Detach the pager, potentially removing the file provider. */ 10.12 @@ -70,7 +70,7 @@ 10.13 10.14 if (_resized) 10.15 { 10.16 - _provider->notify_others(_endpoint, NOTIFY_CONTENT_AVAILABLE); 10.17 + _provider->notify_others(_endpoint, NOTIFY_CONTENT_AVAILABLE, NOTIFY_VALUES_NULL); 10.18 _resized = false; 10.19 } 10.20 10.21 @@ -86,7 +86,7 @@ 10.22 if (err) 10.23 return err; 10.24 10.25 - _provider->notify_all(NOTIFY_FILE_OPENED); 10.26 + _provider->notify_all(NOTIFY_FILE_OPENED, NOTIFY_VALUES_NULL); 10.27 10.28 return ResourceServer(resource).start_thread(file); 10.29 }
11.1 --- a/libfsserver/lib/files/opener_resource.cc Thu Feb 23 23:49:26 2023 +0100 11.2 +++ b/libfsserver/lib/files/opener_resource.cc Sat Feb 25 18:10:13 2023 +0100 11.3 @@ -1,7 +1,7 @@ 11.4 /* 11.5 * A resource offering support for creating contexts and opening files. 11.6 * 11.7 - * Copyright (C) 2021, 2022 Paul Boddie <paul@boddie.org.uk> 11.8 + * Copyright (C) 2021, 2022, 2023 Paul Boddie <paul@boddie.org.uk> 11.9 * 11.10 * This program is free software; you can redistribute it and/or 11.11 * modify it under the terms of the GNU General Public License as 11.12 @@ -67,7 +67,7 @@ 11.13 NOTE: This should also communicate which file was involved, probably 11.14 NOTE: using the file identifier of the opened file. */ 11.15 11.16 - provider->notify_all(NOTIFY_FILE_OPENED); 11.17 + provider->notify_all(NOTIFY_FILE_OPENED, NOTIFY_VALUES_NULL); 11.18 return L4_EOK; 11.19 } 11.20
12.1 --- a/libfsserver/lib/generic/notification.cc Thu Feb 23 23:49:26 2023 +0100 12.2 +++ b/libfsserver/lib/generic/notification.cc Sat Feb 25 18:10:13 2023 +0100 12.3 @@ -51,10 +51,13 @@ 12.4 unsigned int endpoint = _endpoints.size(); 12.5 _endpoints.resize(endpoint + 1); 12.6 12.7 - /* Propagate deferred flags for new endpoints. */ 12.8 + /* Propagate deferred flags and values for new endpoints. */ 12.9 12.10 - if (_deferred) 12.11 - _endpoints[endpoint].deferred = _deferred; 12.12 + if (_deferred_flags) 12.13 + { 12.14 + _endpoints[endpoint].deferred_flags = _deferred_flags; 12.15 + _endpoints[endpoint].deferred_values = _deferred_values; 12.16 + } 12.17 12.18 *endpoint_number = endpoint; 12.19 return _subscribe(endpoint, notifier, flags, subscriber); 12.20 @@ -73,8 +76,11 @@ 12.21 12.22 /* Propagate deferred flags for new endpoints. */ 12.23 12.24 - if (_deferred) 12.25 - _endpoints[endpoint].deferred = _deferred; 12.26 + if (_deferred_flags) 12.27 + { 12.28 + _endpoints[endpoint].deferred_flags = _deferred_flags; 12.29 + _endpoints[endpoint].deferred_values = _deferred_values; 12.30 + } 12.31 12.32 return _subscribe(endpoint, notifier, flags, subscriber); 12.33 } 12.34 @@ -102,10 +108,11 @@ 12.35 12.36 /* Send deferred conditions held from before subscription occurred. */ 12.37 12.38 - if (ep.deferred) 12.39 + if (ep.deferred_flags) 12.40 { 12.41 - _notify(endpoint, ep.deferred); 12.42 - ep.deferred = 0; 12.43 + _notify(endpoint, ep.deferred_flags, ep.deferred_values); 12.44 + ep.deferred_flags = 0; 12.45 + ep.deferred_values = NOTIFY_VALUES_NULL; 12.46 } 12.47 12.48 /* Record the subscriber's notifier. */ 12.49 @@ -143,21 +150,24 @@ 12.50 if (ep.notifiers.empty()) 12.51 { 12.52 ep.flags = 0; 12.53 - ep.deferred = 0; 12.54 + ep.deferred_flags = 0; 12.55 + ep.deferred_values = NOTIFY_VALUES_NULL; 12.56 } 12.57 } 12.58 } 12.59 12.60 /* Notify a particular endpoint. */ 12.61 12.62 -void NotificationSupport::notify(unsigned int endpoint, notify_flags_t flags) 12.63 +void NotificationSupport::notify(unsigned int endpoint, notify_flags_t flags, 12.64 + notify_values_t values) 12.65 { 12.66 std::lock_guard<std::mutex> guard(_lock); 12.67 12.68 - _notify(endpoint, flags); 12.69 + _notify(endpoint, flags, values); 12.70 } 12.71 12.72 -void NotificationSupport::_notify(unsigned int endpoint, notify_flags_t flags) 12.73 +void NotificationSupport::_notify(unsigned int endpoint, notify_flags_t flags, 12.74 + notify_values_t values) 12.75 { 12.76 if (endpoint >= _endpoints.size()) 12.77 return; 12.78 @@ -177,37 +187,47 @@ 12.79 { 12.80 client_Notifier notifier(*it); 12.81 12.82 - notifier.notify(flags & ep.flags, (notify_values_t) NOTIFY_VALUES_NULL); 12.83 + notifier.notify(flags & ep.flags, values); 12.84 } 12.85 } 12.86 } 12.87 else 12.88 - ep.deferred = flags; 12.89 + { 12.90 + ep.deferred_flags = flags; 12.91 + ep.deferred_values = values; 12.92 + } 12.93 } 12.94 12.95 /* Notify all endpoints. */ 12.96 12.97 -void NotificationSupport::notify_all(notify_flags_t flags) 12.98 +void NotificationSupport::notify_all(notify_flags_t flags, notify_values_t values) 12.99 { 12.100 std::lock_guard<std::mutex> guard(_lock); 12.101 12.102 for (unsigned int i = 0; i < _endpoints.size(); i++) 12.103 - _notify(i, flags); 12.104 + _notify(i, flags, values); 12.105 12.106 - _deferred |= flags; 12.107 + /* Accumulate flags, but only record the most recent values. */ 12.108 + 12.109 + _deferred_flags |= flags; 12.110 + _deferred_values = values; 12.111 } 12.112 12.113 /* Notify the other endpoints. */ 12.114 12.115 -void NotificationSupport::notify_others(unsigned int endpoint, notify_flags_t flags) 12.116 +void NotificationSupport::notify_others(unsigned int endpoint, notify_flags_t flags, 12.117 + notify_values_t values) 12.118 { 12.119 std::lock_guard<std::mutex> guard(_lock); 12.120 12.121 for (unsigned int i = 0; i < _endpoints.size(); i++) 12.122 if (i != endpoint) 12.123 - _notify(i, flags); 12.124 + _notify(i, flags, values); 12.125 12.126 - _deferred |= flags; 12.127 + /* Accumulate flags, but only record the most recent values. */ 12.128 + 12.129 + _deferred_flags |= flags; 12.130 + _deferred_values = values; 12.131 } 12.132 12.133 /* Release notifiers for each endpoint. */ 12.134 @@ -226,7 +246,8 @@ 12.135 12.136 ep.notifiers.clear(); 12.137 ep.flags = 0; 12.138 - ep.deferred = 0; 12.139 + ep.deferred_flags = 0; 12.140 + ep.deferred_values = NOTIFY_VALUES_NULL; 12.141 } 12.142 } 12.143
13.1 --- a/libfsserver/lib/pipes/pipe_pager.cc Thu Feb 23 23:49:26 2023 +0100 13.2 +++ b/libfsserver/lib/pipes/pipe_pager.cc Sat Feb 25 18:10:13 2023 +0100 13.3 @@ -62,7 +62,8 @@ 13.4 13.5 /* Notify the other endpoint and unsubscribe. */ 13.6 13.7 - _paging->notify_others(_writing ? PipePaging::WRITER : PipePaging::READER, NOTIFY_PEER_CLOSED); 13.8 + _paging->notify_others(_writing ? PipePaging::WRITER : PipePaging::READER, 13.9 + NOTIFY_PEER_CLOSED, NOTIFY_VALUES_NULL); 13.10 unsubscribe(); 13.11 13.12 /* Deallocate the paging coordinator if no other endpoints are active. */ 13.13 @@ -170,7 +171,8 @@ 13.14 // NOTE: Perhaps employ a distinct event type for metadata updates. 13.15 13.16 _paging->notify_others(_writing ? PipePaging::WRITER : PipePaging::READER, 13.17 - NOTIFY_CONTENT_AVAILABLE | NOTIFY_SPACE_AVAILABLE); 13.18 + NOTIFY_CONTENT_AVAILABLE | NOTIFY_SPACE_AVAILABLE, 13.19 + NOTIFY_VALUES_NULL); 13.20 return L4_EOK; 13.21 } 13.22
14.1 --- a/libfsserver/lib/pipes/pipe_paging.cc Thu Feb 23 23:49:26 2023 +0100 14.2 +++ b/libfsserver/lib/pipes/pipe_paging.cc Sat Feb 25 18:10:13 2023 +0100 14.3 @@ -135,7 +135,7 @@ 14.4 14.5 /* Let the writer notify the reader. */ 14.6 14.7 - notify_others(PipePaging::WRITER, NOTIFY_CONTENT_AVAILABLE); 14.8 + notify_others(PipePaging::WRITER, NOTIFY_CONTENT_AVAILABLE, NOTIFY_VALUES_NULL); 14.9 14.10 /* Return the next region's mapper. */ 14.11 14.12 @@ -186,7 +186,7 @@ 14.13 14.14 /* Let the reader notify the writer. */ 14.15 14.16 - notify_others(PipePaging::READER, NOTIFY_SPACE_AVAILABLE); 14.17 + notify_others(PipePaging::READER, NOTIFY_SPACE_AVAILABLE, NOTIFY_VALUES_NULL); 14.18 14.19 return mapper; 14.20 }
15.1 --- a/libsystypes/idl/parent_pager_object.idl Thu Feb 23 23:49:26 2023 +0100 15.2 +++ b/libsystypes/idl/parent_pager_object.idl Sat Feb 25 18:10:13 2023 +0100 15.3 @@ -1,4 +1,5 @@ 15.4 +import "notification.idl"; 15.5 import "pager_object.idl"; 15.6 import "parent.idl"; 15.7 15.8 -interface ParentPagerObject composes Parent, PagerObject; 15.9 +interface ParentPagerObject composes Parent, PagerObject, Notification;
16.1 --- a/libsystypes/idl/process_creator.idl Thu Feb 23 23:49:26 2023 +0100 16.2 +++ b/libsystypes/idl/process_creator.idl Sat Feb 25 18:10:13 2023 +0100 16.3 @@ -1,7 +1,6 @@ 16.4 interface ProcessCreator 16.5 { 16.6 - /* Start a process, using the given file reference as the payload, indicating 16.7 - a notifier to receive notifications. */ 16.8 + /* Start a process, using the given file reference as the payload. */ 16.9 16.10 - [opcode(30)] void start(in cap program, in cap notifier); 16.11 + [opcode(30)] void start(in cap program, out cap process); 16.12 };
17.1 --- a/tests/dstest_exec.cc Thu Feb 23 23:49:26 2023 +0100 17.2 +++ b/tests/dstest_exec.cc Sat Feb 25 18:10:13 2023 +0100 17.3 @@ -52,15 +52,13 @@ 17.4 return 1; 17.5 } 17.6 17.7 - /* Create a new process structure and obtain the common notifier. */ 17.8 + /* Create a new process structure. */ 17.9 17.10 process_t *process = process_new(); 17.11 - process_notifier_t *notifier = process_notify_task(); 17.12 17.13 - /* Start a process for the given program, specifying a notifier from which an 17.14 - endpoint will be obtained for notifications. */ 17.15 + /* Start a process for the given program. */ 17.16 17.17 - err = process_start(process, program_file, notifier); 17.18 + err = process_start(process, program_file); 17.19 17.20 /* NOTE: Need to be able to send arguments, which would be sent via a context, 17.21 although capabilities could be sent via arguments. */ 17.22 @@ -73,10 +71,30 @@ 17.23 17.24 printf("Finished program initiation.\n"); 17.25 17.26 + /* Obtain the common notifier. */ 17.27 + 17.28 + process_notifier_t *notifier = process_notify_task(); 17.29 + 17.30 + /* Subscribe to the process for notifications. */ 17.31 + 17.32 + err = process_notify_subscribe(process, NOTIFY_TASK_SIGNAL, notifier); 17.33 + 17.34 + if (err) 17.35 + { 17.36 + printf("Could not subscribe to process: %s\n", l4sys_errtostr(err)); 17.37 + return 1; 17.38 + } 17.39 + 17.40 /* Wait for a signal from the process. */ 17.41 17.42 err = process_notify_wait_process(process, notifier); 17.43 17.44 + if (err) 17.45 + { 17.46 + printf("Could not wait for process: %s\n", l4sys_errtostr(err)); 17.47 + return 1; 17.48 + } 17.49 + 17.50 notify_flags_t flags = process_notifications(process); 17.51 notify_values_t values = process_notification_values(process); 17.52