diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-04 23:40:37 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-04 23:40:37 +0300 |
| commit | a6557ed0233e2193cef0ab5b4cea7f1d7f19ad5d (patch) | |
| tree | 1562d5100331d45395b009be44a612a7c792108e /src/uapi/ipc.c | |
| parent | fdbc5adf83741d7e3af0c3f0ffdb59bdf42493b6 (diff) | |
| download | kmi-a6557ed0233e2193cef0ab5b4cea7f1d7f19ad5d.tar.gz kmi-a6557ed0233e2193cef0ab5b4cea7f1d7f19ad5d.zip | |
use notification framework for orphanizing threads
Diffstat (limited to 'src/uapi/ipc.c')
| -rw-r--r-- | src/uapi/ipc.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/uapi/ipc.c b/src/uapi/ipc.c index bc49dbb..ddc7242 100644 --- a/src/uapi/ipc.c +++ b/src/uapi/ipc.c @@ -138,8 +138,8 @@ static bool __enough_rpc_stack(struct tcb *t) /** * Actually run notification handler, no ifs or buts. * - * @param t Previous thread. - * @param r Next thread. + * @param t Current thread. + * @param r Process where notification handler is. * * \p t and \p r may be the same thread. */ @@ -148,12 +148,15 @@ static __noreturn void __run_notify(struct tcb *t, struct tcb *r) use_tcb(r); enum sys_user code = SYS_USER_NOTIFY; - /* if we're not in RPC, we can safely notify of a signal while we're at - * it */ - enum notify_flag flags = is_rpc(t) ? 0 : NOTIFY_SIGNAL; + enum notify_flag flags = 0; + + /* if we're in the root process, we can safely handle signals and + * becoming orphaned */ + if (!is_rpc(t)) + set_bits(flags, t->notify_flags & (NOTIFY_SIGNAL | NOTIFY_ORPHANED)); /* handle critical notifications with special care */ - if (is_set(flags, NOTIFY_IRQ | NOTIFY_TIMER)) { + if (is_set(t->notify_flags, NOTIFY_IRQ | NOTIFY_TIMER)) { set_bits(flags, t->notify_flags & (NOTIFY_IRQ | NOTIFY_TIMER)); disable_irqs(); } |
