lkml.org 
[lkml]   [2009]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@redhat.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.



\
 
 \ /
  Last update: 2009-01-07 18:23    [W:0.916 / U:1.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site