Re: [PATCH -mm 4/5][AIO] - AIO completion signal notification

From: Christoph Hellwig
Date: Wed Nov 29 2006 - 08:50:50 EST


On Wed, Nov 29, 2006 at 02:08:01PM +0100, S?bastien Dugu? wrote:
> On Wed, 29 Nov 2006 10:51:50 +0000, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
>
> > I'm a little bit unhappy about the usage of the notify flag. The usage
> > seems correct but very confusing:
>
> Well, I followed the logic from posix-timers.c, but it may be a poor
> choice ;-)
>
> For a start, the SIGEV_* flags are quite confusing (for me at least).
> SIGEV_SIGNAL is defined as 0, SIGEV_NONE as 1 and SIGEV_THREAD_ID as 4. I
> would rather have seen SIGEV_NONE defined as 0 to avoid all this.
>
> I also wish I knew why those SIGEV_* constants were defined that way.

Ah, I missed that. It explains some of the more wierd bits. I suspect
we should then use != SIGEV_NONE for the any kind of signal notification
bit and == SIGEV_THREAD_ID for the case where we want to deliver to
a particular thread.

But this means we only get a thread reference for SIGEV_THREAD_ID
here:

> > > + if (notify->notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID)) {
> > > + /*
> > > + * This reference will be dropped in really_put_req() when
> > > + * we're done with the request.
> > > + */
> > > + get_task_struct(target);
> > > + }

But even use it for SIGEV_SIGNAL without SIGEV_THREAD_ID here:

> > > + if (notify->notify & SIGEV_THREAD_ID)
> > > + ret = send_sigqueue(notify->signo, sigq, notify->target);
> > > + else
> > > + ret = send_group_sigqueue(notify->signo, sigq, notify->target);

Or do I miss something?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/