1: # 2: /* 3: */ 4: 5: /* 6: * indirect driver for controlling tty. 7: */ 8: #include "../param.h" 9: #include "../conf.h" 10: #include "../user.h" 11: #include "../tty.h" 12: #include "../proc.h" 13: 14: syopen(dev, flag) 15: { 16: register *tp; 17: 18: if(tp = syttyp()) 19: (*cdevsw[tp->t_dev.d_major].d_open)(tp->t_dev, flag); 20: } 21: 22: syread(dev) 23: { 24: register *tp; 25: 26: if(tp = syttyp()) 27: (*cdevsw[tp->t_dev.d_major].d_read)(tp->t_dev); 28: } 29: 30: sywrite(dev) 31: { 32: register *tp; 33: 34: if(tp = syttyp()) 35: (*cdevsw[tp->t_dev.d_major].d_write)(tp->t_dev); 36: } 37: 38: sysgtty(dev, flag) 39: { 40: register *tp; 41: 42: if(tp = syttyp()) 43: (*cdevsw[tp->t_dev.d_major].d_sgtty)(tp->t_dev, flag); 44: } 45: 46: syttyp() 47: { 48: register tp; 49: 50: tp = u.u_procp->p_ttyp; 51: if(tp == NULL) 52: u.u_error = ENXIO; 53: return(tp); 54: }