|
|
1.1 ! root 1: /* $Header: /src386/kernel/io.386/RCS/ct.c,v 1.6 93/04/16 06:58:37 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 1.6 93/04/16 06:58:37 bin ! 21: * Hal: kernel 76 update ! 22: * ! 23: * Revision 1.2 92/01/06 12:26:48 hal ! 24: * Compile with cc.mwc. ! 25: * ! 26: * Revision 1.1 88/03/24 16:18:09 src ! 27: * Initial revision ! 28: * ! 29: * 86/11/19 Allan Cornish /usr/src/sys/drv/ct.c ! 30: * Added support for System V.3 compatible polls. ! 31: */ ! 32: #include <sys/coherent.h> ! 33: #include <sys/con.h> ! 34: #include <errno.h> ! 35: #include <sys/proc.h> ! 36: #include <sys/stat.h> ! 37: ! 38: /* ! 39: * Functions for configuration. ! 40: */ ! 41: int ctopen(); ! 42: int ctclose(); ! 43: int ctread(); ! 44: int ctwrite(); ! 45: int ctioctl(); ! 46: int ctpoll(); ! 47: int nulldev(); ! 48: int nonedev(); ! 49: ! 50: /* ! 51: * Configuration table. ! 52: */ ! 53: CON ctcon ={ ! 54: DFCHR|DFPOL, /* Flags */ ! 55: 1, /* Major index */ ! 56: ctopen, /* Open */ ! 57: ctclose, /* Close */ ! 58: nulldev, /* Block */ ! 59: ctread, /* Read */ ! 60: ctwrite, /* Write */ ! 61: ctioctl, /* Ioctl */ ! 62: nulldev, /* Powerfail */ ! 63: nulldev, /* Timeout */ ! 64: nulldev, /* Load */ ! 65: nulldev, /* Unload */ ! 66: ctpoll /* Poll */ ! 67: }; ! 68: ! 69: /* ! 70: * Open. ! 71: */ ! 72: ctopen(dev, m) ! 73: dev_t dev; ! 74: { ! 75: register dev_t ttdev; ! 76: ! 77: if ((ttdev=SELF->p_ttdev) == NODEV) { ! 78: u.u_error = ENXIO; ! 79: return; ! 80: } ! 81: dopen(ttdev, m, DFCHR); ! 82: } ! 83: ! 84: /* ! 85: * Close. ! 86: */ ! 87: ctclose(dev) ! 88: dev_t dev; ! 89: { ! 90: dclose(SELF->p_ttdev); ! 91: } ! 92: ! 93: /* ! 94: * Read. ! 95: */ ! 96: ctread(dev, iop) ! 97: dev_t dev; ! 98: IO *iop; ! 99: { ! 100: dread(SELF->p_ttdev, iop); ! 101: } ! 102: ! 103: /* ! 104: * Write. ! 105: */ ! 106: ctwrite(dev, iop) ! 107: dev_t dev; ! 108: IO *iop; ! 109: { ! 110: dwrite(SELF->p_ttdev, iop); ! 111: } ! 112: ! 113: /* ! 114: * Ioctl. ! 115: */ ! 116: ctioctl(dev, com, vec) ! 117: dev_t dev; ! 118: struct sgttyb *vec; ! 119: { ! 120: dioctl(SELF->p_ttdev, com, vec); ! 121: } ! 122: ! 123: /* ! 124: * Poll. ! 125: */ ! 126: ctpoll(dev, ev) ! 127: dev_t dev; ! 128: int ev; ! 129: { ! 130: return dpoll(SELF->p_ttdev, ev); ! 131: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.