|
|
1.1 ! root 1: /* $Header: /src386/STREAMS/io.386/RCS/ct.c,v 2.3 93/08/09 13:44:24 bin Exp Locker: bin $ */ ! 2: /* (lgl- ! 3: * The information contained herein is a trade secret of Mark Williams ! 4: * Company, and is confidential information. It is provided under a ! 5: * license agreement, and may be copied or disclosed only under the ! 6: * terms of that agreement. Any reproduction or disclosure of this ! 7: * material without the express written authorization of Mark Williams ! 8: * Company or persuant to the license agreement is unlawful. ! 9: * ! 10: * COHERENT Version 2.3.37 ! 11: * Copyright (c) 1982, 1983, 1984. ! 12: * An unpublished work by Mark Williams Company, Chicago. ! 13: * All rights reserved. ! 14: -lgl) */ ! 15: /* ! 16: * Coherent ! 17: * Console terminal driver. ! 18: * ! 19: * $Log: ct.c,v $ ! 20: * Revision 2.3 93/08/09 13:44:24 bin ! 21: * Kernel 82 changes ! 22: * ! 23: * Revision 2.2 93/07/26 15:28:02 nigel ! 24: * Nigel's R80 ! 25: * ! 26: * Revision 1.2 92/01/06 12:26:48 hal ! 27: * Compile with cc.mwc. ! 28: * ! 29: * Revision 1.1 88/03/24 16:18:09 src ! 30: * Initial revision ! 31: * ! 32: * 86/11/19 Allan Cornish /usr/src/sys/drv/ct.c ! 33: * Added support for System V.3 compatible polls. ! 34: */ ! 35: #include <sys/coherent.h> ! 36: #include <sys/con.h> ! 37: #include <sys/errno.h> ! 38: #include <sys/proc.h> ! 39: #include <sys/stat.h> ! 40: ! 41: /* ! 42: * Functions for configuration. ! 43: */ ! 44: int ctopen(); ! 45: int ctclose(); ! 46: int ctread(); ! 47: int ctwrite(); ! 48: int ctioctl(); ! 49: int ctpoll(); ! 50: int nulldev(); ! 51: int nonedev(); ! 52: ! 53: /* ! 54: * Configuration table. ! 55: */ ! 56: CON ctcon ={ ! 57: DFCHR|DFPOL, /* Flags */ ! 58: 1, /* Major index */ ! 59: ctopen, /* Open */ ! 60: ctclose, /* Close */ ! 61: nulldev, /* Block */ ! 62: ctread, /* Read */ ! 63: ctwrite, /* Write */ ! 64: ctioctl, /* Ioctl */ ! 65: nulldev, /* Powerfail */ ! 66: nulldev, /* Timeout */ ! 67: nulldev, /* Load */ ! 68: nulldev, /* Unload */ ! 69: ctpoll /* Poll */ ! 70: }; ! 71: ! 72: /* ! 73: * Open. ! 74: */ ! 75: ctopen(dev, m) ! 76: dev_t dev; ! 77: { ! 78: register dev_t ttdev; ! 79: ! 80: if ((ttdev=SELF->p_ttdev) == NODEV) { ! 81: u.u_error = ENXIO; ! 82: return; ! 83: } ! 84: dopen(ttdev, m, DFCHR); ! 85: } ! 86: ! 87: /* ! 88: * Close. ! 89: */ ! 90: ctclose(dev) ! 91: dev_t dev; ! 92: { ! 93: dclose(SELF->p_ttdev); ! 94: } ! 95: ! 96: /* ! 97: * Read. ! 98: */ ! 99: ctread(dev, iop) ! 100: dev_t dev; ! 101: IO *iop; ! 102: { ! 103: dread(SELF->p_ttdev, iop); ! 104: } ! 105: ! 106: /* ! 107: * Write. ! 108: */ ! 109: ctwrite(dev, iop) ! 110: dev_t dev; ! 111: IO *iop; ! 112: { ! 113: dwrite(SELF->p_ttdev, iop); ! 114: } ! 115: ! 116: /* ! 117: * Ioctl. ! 118: */ ! 119: ! 120: ctioctl(dev, com, vec, mode) ! 121: dev_t dev; ! 122: struct sgttyb *vec; ! 123: { ! 124: dioctl (SELF->p_ttdev, com, vec, mode, NULL); ! 125: } ! 126: ! 127: ! 128: /* ! 129: * Poll. ! 130: */ ! 131: ! 132: ctpoll(dev, ev) ! 133: dev_t dev; ! 134: int ev; ! 135: { ! 136: return dpoll(SELF->p_ttdev, ev); ! 137: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.