[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090107172431.GA24982@elte.hu>
Date: Wed, 7 Jan 2009 18:24:31 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Oleg Nesterov <oleg@...hat.com>
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
* Oleg Nesterov <oleg@...hat.com> wrote:
> 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 ;)
yeah, ->ops should be ->options. The name ->ops is generally use for
method vectors and so.
Ingo
--
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