aboutsummaryrefslogtreecommitdiff
path: root/common/uapi/ipc.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-09-23 01:03:34 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-09-23 01:03:34 +0300
commit54df2c4c0a61c03cba268e45e0fd85bf2a7e564b (patch)
tree35cf4d489e20bb0819dd453579a83cd3dd28b587 /common/uapi/ipc.c
parent12bfd21818b7a90887dd4c6a92817b791fdb7600 (diff)
downloadkmi-54df2c4c0a61c03cba268e45e0fd85bf2a7e564b.tar.gz
kmi-54df2c4c0a61c03cba268e45e0fd85bf2a7e564b.zip
add notify_state to tcb
Diffstat (limited to 'common/uapi/ipc.c')
-rw-r--r--common/uapi/ipc.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/common/uapi/ipc.c b/common/uapi/ipc.c
index 141b494..826fd57 100644
--- a/common/uapi/ipc.c
+++ b/common/uapi/ipc.c
@@ -95,5 +95,24 @@ SYSCALL_DEFINE2(ipc_notify)(sys_arg_t tid, sys_arg_t swap){
* Arguably slower than directly telling the client which operation was
* finished, but this would require the kernel to keep track of a notify
* stack. While not impossible, probably too complex. */
- return (struct sys_ret){ OK, 0, 0 /* type */, 0 /* from */, 0, 0 };
+
+ /* Something like
+ *
+ * struct tcb *t = get_tcb(tid);
+ * if (t->notify_state == NOTIFY_QUEUED)
+ * return;
+ *
+ * if (t->notify_state == NOTIFY_RUNNING) {
+ * t->notify = NOTIFY_QUEUED;
+ * return;
+ * }
+ *
+ * t->notify_state = NOTIFY_QUEUED;
+ * if (swap)
+ * do_swap(); // clears t->notify when swapped to
+ * // if already running in base state, interrupt,
+ * otherwise wait for return from rpc. If not running,
+ * just queue the interrupt.
+ */
+ return (struct sys_ret){ OK, 0, 0 /* type */, 0, 0, 0 };
}