TODO: still not 100% compatible - more work required

This commit is contained in:
Oliver Lehmann 2008-05-02 08:10:26 +00:00
parent 6606a26fd9
commit 490fb65fdd
1 changed files with 63 additions and 63 deletions

View File

@ -20,18 +20,18 @@
#include <sys/tty.h> #include <sys/tty.h>
#include <sys/ttold.h> #include <sys/ttold.h>
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#include <sys/systm.h>
#include <sys/proc.h> #include <sys/proc.h>
#include <sys/inode.h> #include <sys/inode.h>
#include <sys/mmu.h> #include <sys/mmu.h>
#include <sys/s.out.h> #include <sys/s.out.h>
#include <sys/user.h> #include <sys/user.h>
char ttywstr[] = "@[$]tty.c Rev : 4.2+ 02/07/84 13:50:59";
extern int Canbsiz; extern int Canbsiz;
char canonb[256]; char canonb[256];
extern int numterm; extern int numterm;
char ttywstr[] = {
"@[$]tty.c Rev : 4.2+ 02/07/84 13:50:59"};
int tthiwat[] = { int tthiwat[] = {
0, 0,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
@ -119,16 +119,16 @@ int com;
struct tchars toc; struct tchars toc;
switch (com){ switch (com){
case TCGETA: case IOCTYPE:
u.u_r.r_val1 = TIOC; u.u_r.r_val1 = TIOC;
break; break;
case TIOCFLUSH: case TCSETAW:
case TIOCSETC: case TCSETAF:
ttywait(tp); ttywait(tp);
if (com == TCSETAF) if (com == TCSETAF)
ttyflush(tp, T_RESUME); ttyflush(tp, T_RESUME);
case TIOCGETC: case TCSETA:
if (copyin( addr.l, (caddr_t)&t, sizeof(t)) == 0){ if (copyin( addr, (caddr_t)&t, sizeof(t))==0){
if (tp->t_line != t.c_line){ if (tp->t_line != t.c_line){
if ((t.c_line < 0) || (t.c_line >= linecnt)){ if ((t.c_line < 0) || (t.c_line >= linecnt)){
u.u_error = EINVAL; u.u_error = EINVAL;
@ -159,26 +159,21 @@ int com;
if (tp->t_lflag != ldmode) if (tp->t_lflag != ldmode)
(*linesw[tp->t_line].l_ioctl)(tp, LDCHG, (long) ldmode, flag); (*linesw[tp->t_line].l_ioctl)(tp, LDCHG, (long) ldmode, flag);
if (tmod) return(1); if (tmod) return(1);
} else
u.u_error = EFAULT;
break; break;
} case TCGETA:
break;
case IOCTYPE:
t.c_iflag = tp->t_iflag; t.c_iflag = tp->t_iflag;
t.c_oflag = tp->t_oflag; t.c_oflag = tp->t_oflag;
t.c_cflag = tp->t_cflag; t.c_cflag = tp->t_cflag;
t.c_lflag = tp->t_lflag; t.c_lflag = tp->t_lflag;
t.c_line = tp->t_line; t.c_line = tp->t_line;
bcopy (tp->t_cc, t.c_tcc, sizeof(tp->t_cc)); bcopy (tp->t_cc, t.c_tcc, sizeof(tp->t_cc));
if (copyout((caddr_t) &t, addr.l, sizeof(t))) if (copyout((caddr_t) &t, addr, sizeof(t)))
u.u_error = EFAULT; u.u_error = EFAULT;
break; break;
case TIOCSETN: case TCXONC:
ttywait(tp); switch (addr){
if ((((long)addr.l) & 0x0000ffffL) == 0)
(*tp->t_proc)(tp, T_BREAK);
break;
case TIOCSETP:
switch (addr.half.right){
case 000: case 000:
(*tp->t_proc)(tp, T_SUSPEND); (*tp->t_proc)(tp, T_SUSPEND);
break; break;
@ -195,28 +190,33 @@ break;
u.u_error = EINVAL; u.u_error = EINVAL;
} }
break; break;
case TCSETAF: case TCSBRK:
ttywait(tp);
if(addr == 0)
(*tp->t_proc)(tp, T_BREAK);
break;
case TIOCFLUSH:
ttyflush(tp, T_RESUME); ttyflush(tp, T_RESUME);
break; break;
case TIOCGETP: case TCFLSH:
switch (addr.half.right){ switch (addr){
case 000: case 000:
case 001: case 001:
case 002: case 002:
ttyflush(tp, (addr.half.right+1)&3); ttyflush(tp, addr);
break; break;
default: default:
u.u_error = EINVAL; u.u_error = EINVAL;
} }
break; break;
case TCXCLUSE: case TIOCHPCL:
tp->t_cflag |= HUPCL; tp->t_cflag |= HUPCL;
break; break;
case TCXONC: case TIOCSETP:
ttywait(tp); ttywait(tp);
ttyflush(tp, T_RESUME); ttyflush(tp, T_RESUME);
case TCSBRK: case TIOCSETN:
if (copyin( addr.l, (caddr_t) &told, sizeof(told))){ if (copyin( addr, (caddr_t) &told, sizeof(told))){
cflg = tp->t_cflag; cflg = tp->t_cflag;
iflg = tp->t_iflag; iflg = tp->t_iflag;
tp->t_iflag = 0; tp->t_iflag = 0;
@ -307,7 +307,7 @@ break;
else else
u.u_error = EFAULT; u.u_error = EFAULT;
break; break;
case TCFLSH: case TIOCGETP:
told.sg_ospeed = told.sg_ispeed = tp->t_cflag & CBAUD; told.sg_ospeed = told.sg_ispeed = tp->t_cflag & CBAUD;
told.sg_erase = tp->t_cc[VERASE]; told.sg_erase = tp->t_cc[VERASE];
told.sg_kill = (long)tp->t_cc[VKILL]; told.sg_kill = (long)tp->t_cc[VKILL];
@ -349,17 +349,17 @@ break;
if (tp->t_iflag & IXOFF) if (tp->t_iflag & IXOFF)
ldmode |= O_TANDEM; ldmode |= O_TANDEM;
told.sg_flags = ldmode; told.sg_flags = ldmode;
if (copyout((caddr_t) &told, addr.l, sizeof(told))) if (copyout((caddr_t) &told, addr, sizeof(told)))
u.u_error = EFAULT; u.u_error = EFAULT;
break; break;
case TIOCHPCL: case TCXCLUSE:
tp->t_state |= XCLUSE; tp->t_state |= XCLUSE;
break; break;
case TCNXCLUSE: case TCNXCLUSE:
tp->t_state &= ~XCLUSE; tp->t_state &= ~XCLUSE;
break; break;
case TCSETAW: case TIOCSETC:
if (copyin( addr.l, (caddr_t) &toc, sizeof(toc))){ if (copyin( addr, (caddr_t) &toc, sizeof(toc))){
tp->t_cc[VINTR] = toc.t_intrc; tp->t_cc[VINTR] = toc.t_intrc;
tp->t_cc[VQUIT] = toc.t_quitc; tp->t_cc[VQUIT] = toc.t_quitc;
if (tp->t_lflag & ICANON) if (tp->t_lflag & ICANON)
@ -368,19 +368,19 @@ break;
else else
u.u_error = EFAULT; u.u_error = EFAULT;
break; break;
case TCSETA: case TIOCGETC:
toc.t_intrc = tp->t_cc[VINTR]; toc.t_intrc = tp->t_cc[VINTR];
toc.t_quitc = tp->t_cc[VQUIT]; toc.t_quitc = tp->t_cc[VQUIT];
toc.t_eofc = tp->t_cc[VEOF]; toc.t_eofc = tp->t_cc[VEOF];
toc.t_startc = CSTART; toc.t_startc = CSTART;
toc.t_stopc = CSTOP; toc.t_stopc = CSTOP;
toc.t_brkc = 0; toc.t_brkc = 0;
if (copyout((caddr_t)&toc, addr.l, sizeof(toc))) if (copyout((caddr_t)&toc, addr, sizeof(toc)))
u.u_error =EFAULT; u.u_error =EFAULT;
break; break;
default: default:
if ((com & IOCTYPE) == LDIOC) if ((com & IOCTYPE) == LDIOC)
(*linesw[tp->t_line].l_ioctl)(tp, com, addr.l, flag); (*linesw[tp->t_line].l_ioctl)(tp, com, addr, flag);
else else
u.u_error = EINVAL; u.u_error = EINVAL;
} }