-/* $OpenBSD: kern_descrip.c,v 1.176 2018/07/07 16:14:40 visa Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.177 2018/07/10 08:58:50 mpi Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
break;
case F_GETOWN:
- if (fp->f_type == DTYPE_SOCKET) {
- *retval = ((struct socket *)fp->f_data)->so_pgid;
- break;
- }
- if (fp->f_type == DTYPE_PIPE) {
- *retval = ((struct pipe *)fp->f_data)->pipe_pgid;
- break;
- }
tmp = 0;
error = (*fp->f_ops->fo_ioctl)
(fp, TIOCGPGRP, (caddr_t)&tmp, p);
case F_SETOWN:
tmp = (long)SCARG(uap, arg);
- if (fp->f_type == DTYPE_SOCKET) {
- struct socket *so = fp->f_data;
-
- so->so_pgid = tmp;
- 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 = fp->f_data;
-
- mpipe->pipe_pgid = tmp;
- break;
- }
- if (tmp <= 0) {
+ if (fp->f_type == DTYPE_SOCKET || fp->f_type == DTYPE_PIPE) {
+ /* nothing */
+ } else if (tmp <= 0) {
tmp = -tmp;
} else {
struct process *pr1 = prfind(tmp);
-/* $OpenBSD: sys_generic.c,v 1.119 2018/05/08 08:53:41 mpi Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.120 2018/07/10 08:58:50 mpi Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
syscallarg(void *) data;
} */ *uap = v;
struct file *fp;
- struct filedesc *fdp;
+ struct filedesc *fdp = p->p_fd;
u_long com = SCARG(uap, com);
int error = 0;
u_int size;
#define STK_PARAMS 128
long long stkbuf[STK_PARAMS / sizeof(long long)];
- fdp = p->p_fd;
if ((fp = fd_getfile_mode(fdp, SCARG(uap, fd), FREAD|FWRITE)) == NULL)
return (EBADF);
case FIOSETOWN:
tmp = *(int *)data;
- if (fp->f_type == DTYPE_SOCKET) {
- struct socket *so = fp->f_data;
- so->so_pgid = tmp;
- so->so_siguid = p->p_ucred->cr_ruid;
- so->so_sigeuid = p->p_ucred->cr_uid;
- error = 0;
- break;
- }
- if (tmp <= 0) {
+ if (fp->f_type == DTYPE_SOCKET || fp->f_type == DTYPE_PIPE) {
+ /* nothing */
+ } else if (tmp <= 0) {
tmp = -tmp;
} else {
struct process *pr = prfind(tmp);
break;
case FIOGETOWN:
- if (fp->f_type == DTYPE_SOCKET) {
- error = 0;
- *(int *)data = ((struct socket *)fp->f_data)->so_pgid;
- break;
- }
error = (*fp->f_ops->fo_ioctl)(fp, TIOCGPGRP, data, p);
*(int *)data = -*(int *)data;
break;
-/* $OpenBSD: sys_pipe.c,v 1.81 2018/06/18 09:15:05 mpi Exp $ */
+/* $OpenBSD: sys_pipe.c,v 1.82 2018/07/10 08:58:50 mpi Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
*(int *)data = mpipe->pipe_buffer.cnt;
return (0);
+ case TIOCSPGRP:
+ /* FALLTHROUGH */
case SIOCSPGRP:
mpipe->pipe_pgid = *(int *)data;
return (0);
*(int *)data = mpipe->pipe_pgid;
return (0);
+ case TIOCGPGRP:
+ *(int *)data = -mpipe->pipe_pgid;
+ break;
+
}
return (ENOTTY);
}
-/* $OpenBSD: sys_socket.c,v 1.38 2018/06/06 06:55:22 mpi Exp $ */
+/* $OpenBSD: sys_socket.c,v 1.39 2018/07/10 08:58:50 mpi Exp $ */
/* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */
/*
*(int *)data = so->so_rcv.sb_datacc;
break;
+ case TIOCSPGRP:
+ /* FALLTHROUGH */
case SIOCSPGRP:
so->so_pgid = *(int *)data;
so->so_siguid = p->p_ucred->cr_ruid;
so->so_sigeuid = p->p_ucred->cr_uid;
break;
+ case TIOCGPGRP:
+ *(int *)data = -so->so_pgid;
+ break;
+
case SIOCGPGRP:
*(int *)data = so->so_pgid;
break;