public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 12/17] signal: make unhandled_signal() return bool
  2018-06-02 10:36 [PATCH v3 00/17] signal: refactor some functions Christian Brauner
@ 2018-06-02 10:36 ` Christian Brauner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2018-06-02 10:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: ebiederm, gregkh, mingo, james.morris, keescook, peterz, sds,
	viro, akpm, oleg, Christian Brauner

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@brauner.io>
---
v2->v3:
* unchanged
v1->v2:
* unchanged
v0->v1:
* patch added
---
 include/linux/signal.h | 2 +-
 kernel/signal.c        | 8 +++++---
 2 files changed, 6 insertions(+), 4 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 41f9b91db209..70680dd8b588 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -505,13 +505,15 @@ 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;
 	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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3 12/17] signal: make unhandled_signal() return bool
@ 2018-06-02 12:02 Alexey Dobriyan
  0 siblings, 0 replies; 2+ messages in thread
From: Alexey Dobriyan @ 2018-06-02 12:02 UTC (permalink / raw)
  To: Christian Brauner; +Cc: linux-kernel

> -int unhandled_signal(struct task_struct *tsk, int sig)
> +bool unhandled_signal(struct task_struct *tsk, int sig)

This most likely makes code generation worse on embedded arhcs
which will '& 0xFF" internally.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-02 12:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-02 12:02 [PATCH v3 12/17] signal: make unhandled_signal() return bool Alexey Dobriyan
  -- strict thread matches above, loose matches on Subject: below --
2018-06-02 10:36 [PATCH v3 00/17] signal: refactor some functions Christian Brauner
2018-06-02 10:36 ` [PATCH v3 12/17] signal: make unhandled_signal() return bool Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox