> Date: Tue, 20 Sep 2011 01:41:35 +0300
> From: Paul Irofti <[email protected]>
> 
> Linux keeps surprising me everytime!
> 
> This time its their pipe2 system call which adds flags to the pipe call.
> Its the unix-ish way apparently to turn pipes into files on a kernel
> filesystem, or so they claim.
> 
> Anywho, this fixes glibc pipe2 system calls by wrapping against the
> regular pipe systemcall if no flags are set and by signaling we don't
> support that if they are.
> 
> Okay?
> 
> 
> Index: linux_ipc.c
> ===================================================================
> RCS file: /cvs/src/sys/compat/linux/linux_ipc.c,v
> retrieving revision 1.11
> diff -u -p -r1.11 linux_ipc.c
> --- linux_ipc.c       5 Sep 2009 10:28:43 -0000       1.11
> +++ linux_ipc.c       19 Sep 2011 22:37:33 -0000
> @@ -719,3 +719,21 @@ linux_shmctl(p, v, retval)
>       }
>  }
>  #endif /* SYSVSHM */
> +
> +int
> +linux_sys_pipe2(struct proc *p, void *v, register_t *retval)
> +{
> +     struct linux_sys_pipe2_args *uap = v;
> +     struct sys_pipe_args pargs;
> +
> +     /*
> +      * We don't really support pipe2, but glibc falls back to pipe
> +      * we return signal that.
> +      * /
> +     if (SCARG(uap, flags) != 0)
> +             return ENOSYS;

Don't unimplemented system calls return ENOSYS already?  Then the
comment makes no sense.  Because if glibc falls back on pipe if pipe2
fails, you don't need this code at all.

> +
> +     /* If no flag is set then the this is a plain pipe call. */
> +     SCARG(&pargs, fdp) = SCARG(uap, fdp);
> +     return sys_pipe(p, &pargs, retval);
> +}

Reply via email to