lkml.org 
[lkml]   [2013]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/3] signal: add a helper for dequeuing signals from a specified queue (v2)
Date
v2: export the symbol do_dequeue_signal

Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Pavel Emelyanov <xemul@parallels.com>
CC: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
include/linux/sched.h | 13 ++++++++++++-
kernel/signal.c | 12 +++++++-----
2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 206bb08..45871f1 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2221,7 +2221,18 @@ extern void flush_signals(struct task_struct *);
extern void __flush_signals(struct task_struct *);
extern void ignore_signals(struct task_struct *);
extern void flush_signal_handlers(struct task_struct *, int force_default);
-extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info);
+
+#define SIGQUEUE_SHARED 1
+#define SIGQUEUE_PRIVATE 2
+extern int do_dequeue_signal(struct task_struct *tsk,
+ sigset_t *mask, siginfo_t *info, int qmask);
+
+static inline int dequeue_signal(struct task_struct *tsk,
+ sigset_t *mask, siginfo_t *info)
+{
+ return do_dequeue_signal(tsk, mask, info,
+ SIGQUEUE_SHARED | SIGQUEUE_PRIVATE);
+}

static inline int dequeue_signal_lock(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
{
diff --git a/kernel/signal.c b/kernel/signal.c
index ac5f5e7..9d1cfc6 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -600,15 +600,17 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
*
* All callers have to hold the siglock.
*/
-int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
+int do_dequeue_signal(struct task_struct *tsk, sigset_t *mask,
+ siginfo_t *info, int qmask)
{
- int signr;
+ int signr = 0;

/* We only dequeue private signals from ourselves, we don't let
* signalfd steal them
*/
- signr = __dequeue_signal(&tsk->pending, mask, info);
- if (!signr) {
+ if (qmask & SIGQUEUE_PRIVATE)
+ signr = __dequeue_signal(&tsk->pending, mask, info);
+ if (!signr && (qmask & SIGQUEUE_SHARED)) {
signr = __dequeue_signal(&tsk->signal->shared_pending,
mask, info);
/*
@@ -2479,7 +2481,7 @@ out:
}

EXPORT_SYMBOL(recalc_sigpending);
-EXPORT_SYMBOL_GPL(dequeue_signal);
+EXPORT_SYMBOL_GPL(do_dequeue_signal);
EXPORT_SYMBOL(flush_signals);
EXPORT_SYMBOL(force_sig);
EXPORT_SYMBOL(send_sig);
--
1.7.11.7


\
 
 \ /
  Last update: 2013-02-05 13:41    [W:0.174 / U:3.968 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site