1.1 --- a/libfsclient/lib/src/process.cc Thu Feb 23 23:49:26 2023 +0100
1.2 +++ b/libfsclient/lib/src/process.cc Sat Feb 25 18:10:13 2023 +0100
1.3 @@ -62,28 +62,20 @@
1.4 NOTE: This does not yet communicate arguments or obtain input/output
1.5 pipes. */
1.6
1.7 -long process_start(process_t *process, file_t *file, process_notifier_t *notifier)
1.8 +long process_start(process_t *process, file_t *file)
1.9 {
1.10 l4_cap_idx_t server = l4re_env_get_cap("pserver");
1.11
1.12 if (l4_is_invalid_cap(server))
1.13 return -L4_ENOMEM;
1.14
1.15 - /* Obtain a notification endpoint. */
1.16 -
1.17 - l4_cap_idx_t endpoint;
1.18 - long err = process_notify_get_endpoint(process, notifier, &endpoint);
1.19 -
1.20 - if (err)
1.21 - return err;
1.22 -
1.23 /* Obtain a client for the process creator. */
1.24
1.25 client_ProcessCreator creator(server);
1.26
1.27 - /* Start the process, supplying the given endpoint. */
1.28 + /* Start the process, obtaining a reference to it. */
1.29
1.30 - return creator.start(file->ref, endpoint);
1.31 + return creator.start(file->ref, &process->ref);
1.32 }
1.33
1.34
1.35 @@ -149,16 +141,16 @@
1.36
1.37 /* Subscribe to notification events on a process. */
1.38
1.39 -long process_notify_get_endpoint(process_t *process, process_notifier_t *notifier, l4_cap_idx_t *endpoint)
1.40 +long process_notify_subscribe(process_t *process, notify_flags_t flags, process_notifier_t *notifier)
1.41 {
1.42 - return notifier->obj->get_endpoint(process_notifiable(process), endpoint, true);
1.43 + return notifier->obj->subscribe(process_notifiable(process), flags);
1.44 }
1.45
1.46 /* Unsubscribe from notification events on a process. */
1.47
1.48 -long process_notify_remove_endpoint(process_t *process, process_notifier_t *notifier, l4_cap_idx_t endpoint)
1.49 +long process_notify_unsubscribe(process_t *process, process_notifier_t *notifier)
1.50 {
1.51 - return notifier->obj->remove_endpoint(process_notifiable(process), endpoint);
1.52 + return notifier->obj->unsubscribe(process_notifiable(process));
1.53 }
1.54
1.55 /* Wait for a notification event on a process. */
1.56 @@ -168,10 +160,11 @@
1.57 SpecificObjectNotifier *specific_notifier = dynamic_cast<SpecificObjectNotifier *>(notifier->obj);
1.58 long err = specific_notifier->wait_object(process_notifiable(process));
1.59
1.60 - /* Unsubscribe if a closure notification has been received. */
1.61 + /* Unsubscribe if a termination notification has been received. */
1.62
1.63 - //if (!err && (process->notifiable.notifications & NOTIFY_PEER_CLOSED))
1.64 - //process_notify_unsubscribe(process, notifier);
1.65 + if (!err && (process->notifiable.notifications & NOTIFY_TASK_SIGNAL) &&
1.66 + (process->notifiable.values.sig == 0))
1.67 + process_notify_unsubscribe(process, notifier);
1.68
1.69 return err;
1.70 }
1.71 @@ -186,10 +179,11 @@
1.72
1.73 *process = (process_t *) notifiable->base;
1.74
1.75 - /* Unsubscribe if a closure notification has been received. */
1.76 + /* Unsubscribe if a termination notification has been received. */
1.77
1.78 - //if (!err && ((*file)->notifiable.notifications & NOTIFY_PEER_CLOSED))
1.79 - //file_notify_unsubscribe(*file, notifier);
1.80 + if (!err && ((*process)->notifiable.notifications & NOTIFY_TASK_SIGNAL) &&
1.81 + ((*process)->notifiable.values.sig == 0))
1.82 + process_notify_unsubscribe(*process, notifier);
1.83
1.84 return err;
1.85 }