Hi, Setting fcntl(F_SETOWN) for a pipe does not work. fcntl F_SETOWN: Inappropriate ioctl for device
In sys_fcntl() the ioctl(TIOCSPGRP) is called, but the pipe expects SIOCSPGRP. Sockets have a specal case for the same reason. I would prefer that socketpair and pipe behave identical, so I have adapted the special code for pipes. ok? bluhm Index: kern/kern_descrip.c =================================================================== RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_descrip.c,v retrieving revision 1.121 diff -u -p -r1.121 kern_descrip.c --- kern/kern_descrip.c 16 Oct 2015 13:37:43 -0000 1.121 +++ kern/kern_descrip.c 20 Oct 2015 13:02:50 -0000 @@ -429,6 +429,10 @@ restart: *retval = ((struct socket *)fp->f_data)->so_pgid; break; } + if (fp->f_type == DTYPE_PIPE) { + *retval = ((struct pipe *)fp->f_data)->pipe_pgid; + break; + } error = (*fp->f_ops->fo_ioctl) (fp, TIOCGPGRP, (caddr_t)&tmp, p); *retval = -tmp; @@ -441,6 +445,12 @@ restart: so->so_pgid = (long)SCARG(uap, arg); so->so_siguid = p->p_ucred->cr_ruid; so->so_sigeuid = p->p_ucred->cr_uid; + break; + } + if (fp->f_type == DTYPE_PIPE) { + struct pipe *mpipe = (struct pipe *)fp->f_data; + + mpipe->pipe_pgid = (long)SCARG(uap, arg); break; } if ((long)SCARG(uap, arg) <= 0) {