diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2020-01-08 16:27:43 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2020-01-08 16:27:43 +0000 |
commit | d0e18f58af39d455a40c4a1408f98279f45caef3 (patch) | |
tree | b707f917d62851a404877009a45c6e59fc24a47f /sys/kern/kern_descrip.c | |
parent | 2446fb56753f948228e61f6de87c7b869153c29b (diff) |
Unify handling of ioctls FIOSETOWN/SIOCSPGRP/TIOCSPGRP and
FIOGETOWN/SIOCGPGRP/TIOCGPGRP. Do this by determining the meaning of
the ID parameter inside the sigio code. Also add cases for FIOSETOWN
and FIOGETOWN where there have been TIOCSPGRP and TIOCGPGRP before.
These changes allow removing the ID translation from sys_fcntl() and
sys_ioctl().
Idea from NetBSD
OK mpi@, claudio@
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r-- | sys/kern/kern_descrip.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index c042d489daa..947a36431e9 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.194 2020/01/06 10:25:10 visa Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.195 2020/01/08 16:27:41 visa Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -498,26 +498,14 @@ restart: case F_GETOWN: tmp = 0; error = (*fp->f_ops->fo_ioctl) - (fp, TIOCGPGRP, (caddr_t)&tmp, p); - *retval = -tmp; + (fp, FIOGETOWN, (caddr_t)&tmp, p); + *retval = tmp; break; case F_SETOWN: tmp = (long)SCARG(uap, arg); - if (fp->f_type == DTYPE_SOCKET || fp->f_type == DTYPE_PIPE) { - /* nothing */ - } else if (tmp <= 0) { - tmp = -tmp; - } else { - struct process *pr1 = prfind(tmp); - if (pr1 == 0) { - error = ESRCH; - break; - } - tmp = pr1->ps_pgrp->pg_id; - } error = ((*fp->f_ops->fo_ioctl) - (fp, TIOCSPGRP, (caddr_t)&tmp, p)); + (fp, FIOSETOWN, (caddr_t)&tmp, p)); break; case F_SETLKW: |