1*8558Sroot /* tty_tty.c 4.12 82/10/17 */ 235Sbill 335Sbill /* 43117Swnj * Indirect driver for controlling tty. 54487Swnj * 64487Swnj * THIS IS GARBAGE: MUST SOON BE DONE WITH struct inode * IN PROC TABLE. 735Sbill */ 835Sbill #include "../h/param.h" 935Sbill #include "../h/systm.h" 1035Sbill #include "../h/conf.h" 1135Sbill #include "../h/dir.h" 1235Sbill #include "../h/user.h" 1335Sbill #include "../h/tty.h" 1435Sbill #include "../h/proc.h" 157824Sroot #include "../h/uio.h" 1635Sbill 1735Sbill /*ARGSUSED*/ 1835Sbill syopen(dev, flag) 19*8558Sroot dev_t dev; 20*8558Sroot int flag; 2135Sbill { 2235Sbill 23*8558Sroot if (u.u_ttyp == NULL) 24*8558Sroot return (ENXIO); 25*8558Sroot return ((*cdevsw[major(u.u_ttyd)].d_open)(u.u_ttyd, flag)); 2635Sbill } 2735Sbill 2835Sbill /*ARGSUSED*/ 297824Sroot syread(dev, uio) 307824Sroot dev_t dev; 317824Sroot struct uio *uio; 3235Sbill { 3335Sbill 348522Sroot if (u.u_ttyp == NULL) 358522Sroot return (ENXIO); 368522Sroot return ((*cdevsw[major(u.u_ttyd)].d_read)(u.u_ttyd, uio)); 3735Sbill } 3835Sbill 3935Sbill /*ARGSUSED*/ 407824Sroot sywrite(dev, uio) 417824Sroot dev_t dev; 427824Sroot struct uio *uio; 4335Sbill { 4435Sbill 458522Sroot if (u.u_ttyp == NULL) 468522Sroot return (ENXIO); 478522Sroot return ((*cdevsw[major(u.u_ttyd)].d_write)(u.u_ttyd, uio)); 4835Sbill } 4935Sbill 5035Sbill /*ARGSUSED*/ 5135Sbill syioctl(dev, cmd, addr, flag) 525618Sroot dev_t dev; 535618Sroot int cmd; 545618Sroot caddr_t addr; 555618Sroot int flag; 5635Sbill { 5735Sbill 585390Swnj if (cmd == TIOCNOTTY) { 595390Swnj u.u_ttyp = 0; 605390Swnj u.u_ttyd = 0; 615390Swnj u.u_procp->p_pgrp = 0; 62*8558Sroot return (0); 635390Swnj } 64*8558Sroot if (u.u_ttyp == NULL) 65*8558Sroot return (ENXIO); 66*8558Sroot return ((*cdevsw[major(u.u_ttyd)].d_ioctl)(u.u_ttyd, cmd, addr, flag)); 6735Sbill } 684487Swnj 694487Swnj syselect(dev, flag) 704487Swnj { 714487Swnj 725576Swnj if (u.u_ttyp == NULL) { 734487Swnj u.u_error = ENXIO; 745390Swnj return (0); 754487Swnj } 766385Swnj return ((*cdevsw[major(u.u_ttyd)].d_select)(u.u_ttyd, flag)); 774487Swnj } 78