move the COMPAT_SUNOS TIOCGPGRP handling in the compat sunos code proper.

this is the final fix needed for it to run properly as an LKM.  no more
COMPAT_SUNOS hacks around the tree!
This commit is contained in:
mrg 2002-03-02 12:30:43 +00:00
parent ccc760f047
commit d3b3f3e560
2 changed files with 23 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos_ioctl.c,v 1.38 2001/11/13 02:09:18 lukem Exp $ */
/* $NetBSD: sunos_ioctl.c,v 1.39 2002/03/02 12:30:44 mrg Exp $ */
/*
* Copyright (c) 1993 Markus Wild.
@ -27,10 +27,9 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sunos_ioctl.c,v 1.38 2001/11/13 02:09:18 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: sunos_ioctl.c,v 1.39 2002/03/02 12:30:44 mrg Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd32.h"
#include "opt_execfmt.h"
#endif
@ -57,12 +56,6 @@ __KERNEL_RCSID(0, "$NetBSD: sunos_ioctl.c,v 1.38 2001/11/13 02:09:18 lukem Exp $
#include <compat/sunos/sunos.h>
#include <compat/sunos/sunos_syscallargs.h>
#ifdef COMPAT_NETBSD32
#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/sunos32/sunos32.h>
#include <compat/sunos32/sunos32_syscallargs.h>
#endif
#include <compat/common/compat_util.h>
/*
@ -499,22 +492,37 @@ sunos_sys_ioctl(p, v, retval)
return copyout ((caddr_t)&ss, SCARG(uap, data), sizeof (ss));
}
case _IOR('t', 119, int): /* TIOCGPGRP */
{
int pgrp;
error = (*ctl)(fp, TIOCGPGRP, (caddr_t)&pgrp, p);
if (error == 0 && pgrp == 0)
return (EIO);
if (error)
return (error);
return copyout((caddr_t)&pgrp, SCARG(uap, data), sizeof(pgrp));
}
case _IOW('t', 130, int): /* TIOCSETPGRP: posix variant */
SCARG(uap, com) = TIOCSPGRP;
break;
case _IOR('t', 131, int): /* TIOCGETPGRP: posix variant */
{
/*
* sigh, must do error translation on pty devices
* (see also kern/tty_pty.c)
* sigh, must do error translation on pty devices. if the pgrp
* returned is 0 (and no error), we convert this to EIO, if it
* is on a pty.
*/
int pgrp;
struct vnode *vp;
error = (*ctl)(fp, TIOCGPGRP, (caddr_t)&pgrp, p);
if (error) {
vp = (struct vnode *)fp->f_data;
if (error == EIO && vp != NULL &&
vp->v_type == VCHR && major(vp->v_rdev) == 21)
if ((error == EIO || (error == 0 && pgrp == 0)) &&
vp != NULL &&
vp->v_type == VCHR &&
major(vp->v_rdev) == 21)
error = ENOTTY;
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty_pty.c,v 1.59 2002/02/17 19:34:42 christos Exp $ */
/* $NetBSD: tty_pty.c,v 1.60 2002/03/02 12:30:43 mrg Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.59 2002/02/17 19:34:42 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.60 2002/03/02 12:30:43 mrg Exp $");
#include "opt_compat_sunos.h"
@ -767,19 +767,6 @@ ptyioctl(dev, cmd, data, flag, p)
switch (cmd) {
case TIOCGPGRP:
#ifdef COMPAT_SUNOS
{
/*
* I'm not sure about SunOS TIOCGPGRP semantics
* on PTYs, but it's something like this:
*/
extern struct emul emul_sunos;
if (p->p_emul == &emul_sunos && tp->t_pgrp == 0)
return (EIO);
*(int *)data = tp->t_pgrp->pg_id;
return (0);
}
#endif
/*
* We avoid calling ttioctl on the controller since,
* in that case, tp must be the controlling terminal.