From 66617b21372f571211804901749b25ee94df43f9 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 11 Aug 2000 22:20:10 +0000 Subject: [PATCH] Add ibcs2_sys_gtty. --- sys/compat/ibcs2/ibcs2_ioctl.c | 41 +++++++++++++++++++++++++++++++- sys/compat/ibcs2/ibcs2_termios.h | 27 +++++++++++++++++++-- 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/sys/compat/ibcs2/ibcs2_ioctl.c b/sys/compat/ibcs2/ibcs2_ioctl.c index 9ceb168a675e..59c0ce424d69 100644 --- a/sys/compat/ibcs2/ibcs2_ioctl.c +++ b/sys/compat/ibcs2/ibcs2_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_ioctl.c,v 1.19 2000/06/16 01:56:37 matt Exp $ */ +/* $NetBSD: ibcs2_ioctl.c,v 1.20 2000/08/11 22:20:10 matt Exp $ */ /* * Copyright (c) 1994, 1995 Scott Bartram @@ -559,3 +559,42 @@ ibcs2_sys_ioctl(p, v, retval) return ENOSYS; } +int +ibcs2_sys_gtty(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct ibcs2_sys_gtty_args /* { + syscallarg(int) fd; + syscallarg(struct sgttyb *) tb; + } */ *uap = v; + struct filedesc *fdp = p->p_fd; + struct file *fp; + struct sgttyb tb; + struct ibcs2_sgttyb itb; + int error; + + if (SCARG(uap, fd) < 0 || SCARG(uap, fd) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) { + DPRINTF(("ibcs2_sys_gtty(%d): bad fd %d ", p->p_pid, + SCARG(uap, fd))); + return EBADF; + } + + if ((fp->f_flag & (FREAD|FWRITE)) == 0) { + DPRINTF(("ibcs2_sys_gtty(%d): bad fp flag ", p->p_pid)); + return EBADF; + } + + error = (*fp->f_ops->fo_ioctl)(fp, TIOCGETP, (caddr_t)&tb, p); + if (error) + return error; + + itb.sg_ispeed = tb.sg_ispeed; + itb.sg_ospeed = tb.sg_ospeed; + itb.sg_erase = tb.sg_erase; + itb.sg_kill = tb.sg_kill; + itb.sg_flags = tb.sg_flags & ~(IBCS2_GHUPCL|IBCS2_GXTABS); + return copyout((caddr_t)&itb, SCARG(uap, tb), sizeof(itb)); +} diff --git a/sys/compat/ibcs2/ibcs2_termios.h b/sys/compat/ibcs2/ibcs2_termios.h index 35602cf999d9..15c6f97a3c90 100644 --- a/sys/compat/ibcs2/ibcs2_termios.h +++ b/sys/compat/ibcs2/ibcs2_termios.h @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_termios.h,v 1.3 1994/10/26 02:53:07 cgd Exp $ */ +/* $NetBSD: ibcs2_termios.h,v 1.4 2000/08/11 22:20:10 matt Exp $ */ /* * Copyright (c) 1994 Scott Bartram @@ -231,5 +231,28 @@ struct ibcs2_winsize { u_short ws_ypixel; }; -#endif /* _IBCS2_H_ */ +#define IBCS2_GHUPCL 0x0001 +#define IBCS2_GXTABS 0x0002 +#define IBCS2_GLCASE 0x0004 +#define IBCS2_GECHO 0x0008 +#define IBCS2_GCRMOD 0x0010 +#define IBCS2_GRAW 0x0020 +#define IBCS2_GODDP 0x0040 +#define IBCS2_GEVENP 0x0080 +#define IBCS2_GANYP 0x00C0 +#define IBCS2_GNLDELAY 0x0300 +#define IBCS2_GTBDELAY 0x0400 +#define IBCS2_GCRDELAY 0x3000 +#define IBCS2_GVTDELAY 0x4000 +#define IBCS2_GBSDELAY 0x8000 +#define IBCS2_GALLDELAY 0xFF00 +struct ibcs2_sgttyb { + char sg_ispeed; + char sg_ospeed; + char sg_erase; + char sg_kill; + int sg_flags; +}; + +#endif /* _IBCS2_H_ */