1.1 --- a/libexec/lib/src/external_pager.cc Fri Feb 17 18:41:18 2023 +0100
1.2 +++ b/libexec/lib/src/external_pager.cc Sat Feb 18 01:30:37 2023 +0100
1.3 @@ -164,7 +164,7 @@
1.4 long ExternalPager::signal(unsigned long sig, unsigned long val)
1.5 {
1.6 if (_notifier != NULL)
1.7 - _notifier->notify(NOTIFY_TASK_SIGNAL);
1.8 + _notifier->notify(NOTIFY_TASK_SIGNAL, (notify_values_t) {sig, val});
1.9
1.10 return L4_EOK;
1.11 }
2.1 --- a/libfsclient/include/fsclient/notifier.h Fri Feb 17 18:41:18 2023 +0100
2.2 +++ b/libfsclient/include/fsclient/notifier.h Sat Feb 18 01:30:37 2023 +0100
2.3 @@ -43,7 +43,8 @@
2.4
2.5 /* Pending notifications for monitored objects. */
2.6
2.7 - notify_flags_t pending = 0;
2.8 + notify_flags_t pending_notifications = 0;
2.9 + notify_values_t pending_values = NOTIFY_VALUES_NULL;
2.10
2.11 /* Endpoints associated with monitored objects. */
2.12
2.13 @@ -89,7 +90,8 @@
2.14
2.15 /* Helper methods. */
2.16
2.17 - virtual void _notify(notifiable_t *object, notify_flags_t flags) = 0;
2.18 + virtual void _notify(notifiable_t *object, notify_flags_t flags,
2.19 + notify_values_t values) = 0;
2.20
2.21 virtual bool _transfer(ObjectNotificationState &state, notifiable_t *object);
2.22
2.23 @@ -131,7 +133,8 @@
2.24
2.25 /* Helper methods. */
2.26
2.27 - virtual void _notify(notifiable_t *object, notify_flags_t flags);
2.28 + virtual void _notify(notifiable_t *object, notify_flags_t flags,
2.29 + notify_values_t values);
2.30
2.31 virtual bool _retrieve(notifiable_t **object);
2.32
2.33 @@ -150,7 +153,8 @@
2.34 protected:
2.35 /* Helper methods. */
2.36
2.37 - virtual void _notify(notifiable_t *object, notify_flags_t flags);
2.38 + virtual void _notify(notifiable_t *object, notify_flags_t flags,
2.39 + notify_values_t values);
2.40
2.41 public:
2.42 virtual long wait_object(notifiable_t *object);
3.1 --- a/libfsclient/lib/src/Makefile Fri Feb 17 18:41:18 2023 +0100
3.2 +++ b/libfsclient/lib/src/Makefile Sat Feb 18 01:30:37 2023 +0100
3.3 @@ -16,7 +16,7 @@
3.4 # Individual interfaces.
3.5
3.6 CLIENT_INTERFACES_CC = dataspace directory file filesystem flush \
3.7 - mapped_file notification opener \
3.8 + mapped_file notifier notification opener \
3.9 opener_context pipe pipe_opener
3.10
3.11 # Generated and plain source files.
4.1 --- a/libfsclient/lib/src/notifier.cc Fri Feb 17 18:41:18 2023 +0100
4.2 +++ b/libfsclient/lib/src/notifier.cc Sat Feb 18 01:30:37 2023 +0100
4.3 @@ -30,6 +30,7 @@
4.4
4.5 #include "notification_client.h"
4.6 #include "notifier.h"
4.7 +#include "notifier_interface.h"
4.8
4.9
4.10
4.11 @@ -124,7 +125,7 @@
4.12
4.13 ipc_message_open(&msg);
4.14
4.15 - notify_flags_t flags = ipc_message_get_word(&msg, 0);
4.16 + struct in_words_Notifier_notify *in_words = (struct in_words_Notifier_notify *) ipc_message_get_word_address(&msg, 0);
4.17
4.18 /* Reply to notifications. */
4.19
4.20 @@ -133,7 +134,7 @@
4.21
4.22 /* Register the notification. */
4.23
4.24 - _notify(object, flags);
4.25 + _notify(object, in_words->flags, in_words->values);
4.26 }
4.27
4.28 ipc_message_free(&msg);
4.29 @@ -256,7 +257,8 @@
4.30 the generic server dispatch mechanism, with the gate label being interpreted
4.31 and provided as the first parameter. */
4.32
4.33 -void GeneralObjectNotifier::_notify(notifiable_t *object, notify_flags_t flags)
4.34 +void GeneralObjectNotifier::_notify(notifiable_t *object, notify_flags_t flags,
4.35 + notify_values_t values)
4.36 {
4.37 /* Enter critical section for the notifier (affecting all objects). */
4.38
4.39 @@ -275,11 +277,12 @@
4.40
4.41 std::unique_lock<std::mutex> object_guard(state.lock);
4.42
4.43 - /* Record flags and return previous flags. */
4.44 + /* Record flags and note previous flags. */
4.45
4.46 - notify_flags_t recorded = state.pending;
4.47 + notify_flags_t recorded = state.pending_notifications;
4.48
4.49 - state.pending |= flags;
4.50 + state.pending_notifications |= flags;
4.51 + state.pending_values = values;
4.52
4.53 /* Add an object queue entry for any objects without previous notifications. */
4.54
4.55 @@ -291,7 +294,8 @@
4.56 _general_condition.notify_one();
4.57 }
4.58
4.59 -void SpecificObjectNotifier::_notify(notifiable_t *object, notify_flags_t flags)
4.60 +void SpecificObjectNotifier::_notify(notifiable_t *object, notify_flags_t flags,
4.61 + notify_values_t values)
4.62 {
4.63 /* Acquire the lock for state lookup. */
4.64
4.65 @@ -306,7 +310,8 @@
4.66
4.67 std::unique_lock<std::mutex> object_guard(state.lock);
4.68
4.69 - state.pending |= flags;
4.70 + state.pending_notifications |= flags;
4.71 + state.pending_values = values;
4.72
4.73 /* Notify any waiting caller. */
4.74
4.75 @@ -320,12 +325,13 @@
4.76
4.77 bool ObjectNotifier::_transfer(ObjectNotificationState &state, notifiable_t *object)
4.78 {
4.79 - notify_flags_t recorded = state.pending;
4.80 + notify_flags_t recorded = state.pending_notifications;
4.81
4.82 if (recorded)
4.83 {
4.84 object->notifications = recorded;
4.85 - state.pending = 0;
4.86 + object->values = state.pending_values;
4.87 + state.pending_notifications = 0;
4.88 return true;
4.89 }
4.90
5.1 --- a/libfsserver/lib/generic/notification.cc Fri Feb 17 18:41:18 2023 +0100
5.2 +++ b/libfsserver/lib/generic/notification.cc Sat Feb 18 01:30:37 2023 +0100
5.3 @@ -1,7 +1,7 @@
5.4 /*
5.5 * Notification support.
5.6 *
5.7 - * Copyright (C) 2021, 2022 Paul Boddie <paul@boddie.org.uk>
5.8 + * Copyright (C) 2021, 2022, 2023 Paul Boddie <paul@boddie.org.uk>
5.9 *
5.10 * This program is free software; you can redistribute it and/or
5.11 * modify it under the terms of the GNU General Public License as
5.12 @@ -177,7 +177,7 @@
5.13 {
5.14 client_Notifier notifier(*it);
5.15
5.16 - notifier.notify(flags & ep.flags);
5.17 + notifier.notify(flags & ep.flags, (notify_values_t) NOTIFY_VALUES_NULL);
5.18 }
5.19 }
5.20 }
6.1 --- a/libsystypes/idl/notifier.idl Fri Feb 17 18:41:18 2023 +0100
6.2 +++ b/libsystypes/idl/notifier.idl Sat Feb 18 01:30:37 2023 +0100
6.3 @@ -1,8 +1,8 @@
6.4 -#include <systypes/base.h> /* notify_flags_t */
6.5 +#include <systypes/base.h> /* notify_flags_t, notify_values_t */
6.6
6.7 interface Notifier
6.8 {
6.9 /* Send notification events. */
6.10
6.11 - [opcode(25)] void notify(in notify_flags_t flags);
6.12 + [opcode(25)] void notify(in notify_flags_t flags, in notify_values_t values);
6.13 };
7.1 --- a/libsystypes/include/systypes/base.h Fri Feb 17 18:41:18 2023 +0100
7.2 +++ b/libsystypes/include/systypes/base.h Sat Feb 18 01:30:37 2023 +0100
7.3 @@ -47,6 +47,14 @@
7.4
7.5 typedef l4_uint64_t notify_flags_t;
7.6
7.7 +typedef struct
7.8 +{
7.9 + unsigned long sig, val; /* signal-specific values */
7.10 +
7.11 +} notify_values_t;
7.12 +
7.13 +#define NOTIFY_VALUES_NULL ((notify_values_t) {0, 0})
7.14 +
7.15 enum notify_flags
7.16 {
7.17 NOTIFY_CONTENT_AVAILABLE = 0x001, /* reading files and pipes */
7.18 @@ -67,7 +75,8 @@
7.19 typedef struct
7.20 {
7.21 notifiable_base_t *base; /* access to the specific object */
7.22 - notify_flags_t notifications;
7.23 + notify_flags_t notifications; /* essential notifications */
7.24 + notify_values_t values; /* signal-specific values */
7.25
7.26 } notifiable_t;
7.27
8.1 --- a/tests/dstest_exec.cc Fri Feb 17 18:41:18 2023 +0100
8.2 +++ b/tests/dstest_exec.cc Sat Feb 18 01:30:37 2023 +0100
8.3 @@ -34,9 +34,10 @@
8.4 class local_Notifier : public Notifier
8.5 {
8.6 public:
8.7 - long notify(notify_flags_t flags)
8.8 + long notify(notify_flags_t flags, notify_values_t values)
8.9 {
8.10 printf("Notified with flags: %" pFMTnotify_flags "x\n", flags);
8.11 + printf("Notified with values: %ld, %ld\n", values.sig, values.val);
8.12
8.13 return L4_EOK;
8.14 }