123393Smckusick /* 2*29112Smckusick * Copyright (c) 1982, 1986 Regents of the University of California. 323393Smckusick * All rights reserved. The Berkeley software License Agreement 423393Smckusick * specifies the terms and conditions for redistribution. 523393Smckusick * 6*29112Smckusick * @(#)tty_tty.c 7.1 (Berkeley) 06/05/86 723393Smckusick */ 835Sbill 935Sbill /* 103117Swnj * Indirect driver for controlling tty. 114487Swnj * 124487Swnj * THIS IS GARBAGE: MUST SOON BE DONE WITH struct inode * IN PROC TABLE. 1335Sbill */ 1417097Sbloom #include "param.h" 1517097Sbloom #include "systm.h" 1617097Sbloom #include "conf.h" 1717097Sbloom #include "dir.h" 1817097Sbloom #include "user.h" 1917097Sbloom #include "ioctl.h" 2017097Sbloom #include "tty.h" 2117097Sbloom #include "proc.h" 2217097Sbloom #include "uio.h" 2335Sbill 2435Sbill /*ARGSUSED*/ 2535Sbill syopen(dev, flag) 268558Sroot dev_t dev; 278558Sroot int flag; 2835Sbill { 2935Sbill 308558Sroot if (u.u_ttyp == NULL) 318558Sroot return (ENXIO); 328558Sroot return ((*cdevsw[major(u.u_ttyd)].d_open)(u.u_ttyd, flag)); 3335Sbill } 3435Sbill 3535Sbill /*ARGSUSED*/ 367824Sroot syread(dev, uio) 377824Sroot dev_t dev; 387824Sroot struct uio *uio; 3935Sbill { 4035Sbill 418522Sroot if (u.u_ttyp == NULL) 428522Sroot return (ENXIO); 438522Sroot return ((*cdevsw[major(u.u_ttyd)].d_read)(u.u_ttyd, uio)); 4435Sbill } 4535Sbill 4635Sbill /*ARGSUSED*/ 477824Sroot sywrite(dev, uio) 487824Sroot dev_t dev; 497824Sroot struct uio *uio; 5035Sbill { 5135Sbill 528522Sroot if (u.u_ttyp == NULL) 538522Sroot return (ENXIO); 548522Sroot return ((*cdevsw[major(u.u_ttyd)].d_write)(u.u_ttyd, uio)); 5535Sbill } 5635Sbill 5735Sbill /*ARGSUSED*/ 5835Sbill syioctl(dev, cmd, addr, flag) 595618Sroot dev_t dev; 605618Sroot int cmd; 615618Sroot caddr_t addr; 625618Sroot int flag; 6335Sbill { 6435Sbill 655390Swnj if (cmd == TIOCNOTTY) { 665390Swnj u.u_ttyp = 0; 675390Swnj u.u_ttyd = 0; 685390Swnj u.u_procp->p_pgrp = 0; 698558Sroot return (0); 705390Swnj } 718558Sroot if (u.u_ttyp == NULL) 728558Sroot return (ENXIO); 738558Sroot return ((*cdevsw[major(u.u_ttyd)].d_ioctl)(u.u_ttyd, cmd, addr, flag)); 7435Sbill } 754487Swnj 768591Sroot /*ARGSUSED*/ 774487Swnj syselect(dev, flag) 788591Sroot dev_t dev; 798591Sroot int flag; 804487Swnj { 814487Swnj 825576Swnj if (u.u_ttyp == NULL) { 834487Swnj u.u_error = ENXIO; 845390Swnj return (0); 854487Swnj } 866385Swnj return ((*cdevsw[major(u.u_ttyd)].d_select)(u.u_ttyd, flag)); 874487Swnj } 88