[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180528215355.16119-14-christian@brauner.io>
Date: Mon, 28 May 2018 23:53:48 +0200
From: Christian Brauner <christian@...uner.io>
To: linux-kernel@...r.kernel.org
Cc: ebiederm@...ssion.com, gregkh@...uxfoundation.org,
mingo@...nel.org, james.morris@...rosoft.com,
keescook@...omium.org, peterz@...radead.org, sds@...ho.nsa.gov,
viro@...iv.linux.org.uk, akpm@...ux-foundation.org,
oleg@...hat.com, Christian Brauner <christian@...uner.io>
Subject: [PATCH v1 13/20] signal: make has_pending_signals() return bool
has_pending_signals() already behaves like a boolean function. Let's
actually declare it as such too.
Signed-off-by: Christian Brauner <christian@...uner.io>
---
v0->v1:
* patch introduced
---
kernel/signal.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index 60c501db15d9..d2d4d10223ca 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -110,30 +110,33 @@ static bool sig_ignored(struct task_struct *t, int sig, bool force)
* Re-calculate pending state from the set of locally pending
* signals, globally pending signals, and blocked signals.
*/
-static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
+static inline bool has_pending_signals(sigset_t *signal, sigset_t *blocked)
{
unsigned long ready;
long i;
switch (_NSIG_WORDS) {
default:
- for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
- ready |= signal->sig[i] &~ blocked->sig[i];
+ for (i = _NSIG_WORDS, ready = 0; --i >= 0;)
+ ready |= signal->sig[i] & ~blocked->sig[i];
break;
- case 4: ready = signal->sig[3] &~ blocked->sig[3];
- ready |= signal->sig[2] &~ blocked->sig[2];
- ready |= signal->sig[1] &~ blocked->sig[1];
- ready |= signal->sig[0] &~ blocked->sig[0];
+ case 4:
+ ready = signal->sig[3] & ~blocked->sig[3];
+ ready |= signal->sig[2] & ~blocked->sig[2];
+ ready |= signal->sig[1] & ~blocked->sig[1];
+ ready |= signal->sig[0] & ~blocked->sig[0];
break;
- case 2: ready = signal->sig[1] &~ blocked->sig[1];
- ready |= signal->sig[0] &~ blocked->sig[0];
+ case 2:
+ ready = signal->sig[1] & ~blocked->sig[1];
+ ready |= signal->sig[0] & ~blocked->sig[0];
break;
- case 1: ready = signal->sig[0] &~ blocked->sig[0];
+ case 1:
+ ready = signal->sig[0] & ~blocked->sig[0];
}
- return ready != 0;
+ return ready != 0;
}
#define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
--
2.17.0
Powered by blists - more mailing lists