[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0703191718020.3733@alien.or.mcafeemobile.com>
Date: Mon, 19 Mar 2007 17:20:20 -0700 (PDT)
From: Davide Libenzi <davidel@...ilserver.org>
To: Oleg Nesterov <oleg@...sign.ru>
cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [patch 2/13] signal/timer/event fds v7 - signalfd core ...
On Tue, 20 Mar 2007, Oleg Nesterov wrote:
> On 03/19, Davide Libenzi wrote:
> >
> > +struct signalfd_lockctx {
> > + struct task_struct *tsk;
> > + struct sighand_struct *sighand;
> > + unsigned long flags;
> > +};
>
> signalfd_lockctx is "private" to signalfd_lock/signalfd_unlock. But lk->sighand
> is used only by signalfd_lock(). I'd suggest to remove it.
Ack
> > +void signalfd_deliver(struct task_struct *tsk, int sig)
> > +{
> > + struct sighand_struct *sighand = tsk->sighand;
> > + struct signalfd_ctx *ctx, *tmp;
> > +
> > + list_for_each_entry_safe(ctx, tmp, &sighand->sfdlist, lnk) {
> > + /*
> > + * We use a negative signal value as a way to broadcast that the
> > + * sighand has been orphaned, so that we can notify all the
> > + * listeners about this. Remeber the ctx->sigmask is inverted,
> > + * so if the user is interested in a signal, that corresponding
> > + * bit will be zero.
> > + */
> > + if (sig < 0) {
> > + if (ctx->tsk == tsk) {
> > + ctx->tsk = NULL;
> > + list_del_init(&ctx->lnk);
> > + wake_up(&ctx->wqh);
> > + }
> > + } else if (sig > 0) {
> > + if (!sigismember(&ctx->sigmask, sig))
> > + wake_up(&ctx->wqh);
> > + }
> > + }
> > +}
>
> I tried to avoid this comment, but can't help myself :)
Added BUG_ON() and using "else".
- Davide
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists