From: Oleg Nesterov <oleg@tv-sign.ru>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Davide Libenzi <davidel@xmailserver.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [patch] exclude sync signals from signalfd sets
Date: Thu, 21 Jun 2007 13:27:31 +0400 [thread overview]
Message-ID: <20070621092731.GC88@tv-sign.ru> (raw)
In-Reply-To: <alpine.LFD.0.98.0706201255530.3593@woody.linux-foundation.org>
On 06/20, Linus Torvalds wrote:
>
>
> On Wed, 20 Jun 2007, Davide Libenzi wrote:
> >
> > The following patch excludes synchronous signals from being dequeued
> > by a signalfd.
>
> I really prefer the current code. Listign special cases is just ugly. Just
> make it so that thread-local signals stay thread-local, and it's all good.
OK. How about the patch below then? I think this is what Nicholas suggested.
(Sorry for persistance! I can't explain why I think the current behaviour is
not good. Just a personal feeling).
Oleg.
--- signalfd.c~ 2007-06-21 13:00:21.000000000 +0400
+++ signalfd.c 2007-06-21 13:04:45.000000000 +0400
@@ -208,6 +208,15 @@ static int signalfd_copyinfo(struct sign
return err ? -EFAULT: sizeof(*uinfo);
}
+static int
+__signalfd_dequeue(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
+{
+ if (tsk->tgid == current->tgid)
+ tsk = current;
+
+ return dequeue_signal(tsk, mask, info);
+}
+
static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, siginfo_t *info,
int nonblock)
{
@@ -218,7 +227,7 @@ static ssize_t signalfd_dequeue(struct s
if (!signalfd_lock(ctx, &lk))
return 0;
- ret = dequeue_signal(lk.tsk, &ctx->sigmask, info);
+ ret = __signalfd_dequeue(lk.tsk, &ctx->sigmask, info);
switch (ret) {
case 0:
if (!nonblock)
@@ -232,7 +241,7 @@ static ssize_t signalfd_dequeue(struct s
add_wait_queue(&ctx->wqh, &wait);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
- ret = dequeue_signal(lk.tsk, &ctx->sigmask, info);
+ ret = __signalfd_dequeue(lk.tsk, &ctx->sigmask, info);
signalfd_unlock(&lk);
if (ret != 0)
break;
@@ -330,7 +339,7 @@ asmlinkage long sys_signalfd(int ufd, si
init_waitqueue_head(&ctx->wqh);
ctx->sigmask = sigmask;
- ctx->tsk = current;
+ ctx->tsk = current->group_leader;
sighand = current->sighand;
/*
prev parent reply other threads:[~2007-06-21 9:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-20 19:14 Davide Libenzi
2007-06-20 19:56 ` Linus Torvalds
2007-06-20 20:12 ` Davide Libenzi
2007-06-21 9:27 ` Oleg Nesterov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070621092731.GC88@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®