lkml.org 
[lkml]   [2007]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-03-20 01:25    [W:0.034 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site