[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090107171922.GA18000@redhat.com>
Date: Wed, 7 Jan 2009 18:19:22 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Ingo Molnar <mingo@...e.hu>
Cc: Casey Dahlin <cdahlin@...hat.com>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Randy Dunlap <randy.dunlap@...cle.com>,
Roland McGrath <roland@...hat.com>,
Davide Libenzi <davidel@...ilserver.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [RESEND][RFC PATCH v2] waitfd
On 01/07, Ingo Molnar wrote:
>
> (Cc:-ed a few more folks who might be interested in this)
>
> * Casey Dahlin <cdahlin@...hat.com> wrote:
>
> > +asmlinkage long sys_waitfd(int which, pid_t upid, int options, int unused)
> > +{
> > + int ufd;
> > + struct waitfd_ctx *ctx;
> > +
> > + /* Just to make sure we don't end up with a sys_waitfd4 */
> > + (void)unused;
>
> looks a bit silly ...
>
> > +
> > + if (options & ~(WNOHANG|WEXITED|WSTOPPED|WCONTINUED))
> > + return -EINVAL;
> > + if (!(options & (WEXITED|WSTOPPED|WCONTINUED)))
> > + return -EINVAL;
> > +
> > + ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
> > + if (!ctx)
> > + return -ENOMEM;
> > +
> > + ctx->ops = options;
> > + ctx->upid = upid;
> > + ctx->which = which;
> > +
> > + ufd = anon_inode_getfd("[waitfd]", &waitfd_fops, ctx,
> > + (options & WNOHANG) ? O_NONBLOCK : 0);
minor nit...
Please note that unlike other sys_...fd() syscalls, sys_waitfd()
doesn't allow to pass O_CLOEXEC. Looks like we need a separate
"flags" argument...
Also, ioctl(FIONBIO) or fcntl(O_NONBLOCK) have no effect on
waitfd, not very good.
I'd suggest to remove WNOHANG from waitfd_ctx->ops and treat
(->f_flags & O_NONBLOCK) as WNOHANG.
(can't resist, ->ops is not the best name ;)
Oleg.
--
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