[PATCH v1 15/20] signal: make unhandled_signal() return bool
From: Christian Brauner
Date: Mon May 28 2018 - 18:00:22 EST
unhandled_signal() already behaves like a boolean function. Let's actually
declare it as such too.
All callers treat it as such too.
Signed-off-by: Christian Brauner <christian@xxxxxxxxxx>
---
v0->v1:
* patch introduced
---
include/linux/signal.h | 2 +-
kernel/signal.c | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/include/linux/signal.h b/include/linux/signal.h
index a9bc7e1b077e..1145d7061ed9 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -284,7 +284,7 @@ static inline void disallow_signal(int sig)
extern struct kmem_cache *sighand_cachep;
-int unhandled_signal(struct task_struct *tsk, int sig);
+extern bool unhandled_signal(struct task_struct *tsk, int sig);
/*
* In POSIX a signal is sent either to a specific thread (Linux task)
diff --git a/kernel/signal.c b/kernel/signal.c
index 623039987546..c382ac346a81 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -508,13 +508,16 @@ flush_signal_handlers(struct task_struct *t, int force_default)
}
}
-int unhandled_signal(struct task_struct *tsk, int sig)
+bool unhandled_signal(struct task_struct *tsk, int sig)
{
- void __user *handler = tsk->sighand->action[sig-1].sa.sa_handler;
+ void __user *handler = tsk->sighand->action[sig - 1].sa.sa_handler;
+
if (is_global_init(tsk))
- return 1;
+ return true;
+
if (handler != SIG_IGN && handler != SIG_DFL)
- return 0;
+ return false;
+
/* if ptraced, let the tracer determine */
return !tsk->ptrace;
}
--
2.17.0