Annotation of prex-old/include/sys/tty.h, Revision 1.1.1.1
1.1 nbrk 1: /*-
2: * Copyright (c) 1982, 1986, 1993
3: * The Regents of the University of California. All rights reserved.
4: * (c) UNIX System Laboratories, Inc.
5: * All or some portions of this file are derived from material licensed
6: * to the University of California by American Telephone and Telegraph
7: * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8: * the permission of UNIX System Laboratories, Inc.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: * 3. Neither the name of the University nor the names of its contributors
19: * may be used to endorse or promote products derived from this software
20: * without specific prior written permission.
21: *
22: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: * SUCH DAMAGE.
33: *
34: * @(#)tty.h 8.7 (Berkeley) 1/9/95
35: */
36:
37: #ifndef _SYS_TTY_H
38: #define _SYS_TTY_H
39:
40: #include <sys/cdefs.h>
41: #include <sys/termios.h>
42:
43: #ifdef KERNEL
44:
45: #define TTYQ_SIZE 256
46: #define TTYQ_HIWAT 246
47:
48: struct tty_queue {
49: char buf[TTYQ_SIZE];
50: int head;
51: int tail;
52: int count;
53: };
54:
55: /*
56: * Per-tty structure.
57: */
58: struct tty {
59: struct tty_queue t_rawq; /* raw input queue */
60: struct tty_queue t_canq; /* canonical queue */
61: struct tty_queue t_outq; /* ouput queue */
62: struct termios t_termios; /* termios state */
63: struct winsize t_winsize; /* window size */
64:
65: struct event t_input_event; /* event to sleep */
66: void (*t_output)(struct tty *); /* start output */
67: int t_state; /* driver state */
68: int t_column; /* tty output column */
69: pid_t t_pgid; /* foreground process group. */
70: };
71:
72: #define t_iflag t_termios.c_iflag
73: #define t_oflag t_termios.c_oflag
74: #define t_cflag t_termios.c_cflag
75: #define t_lflag t_termios.c_lflag
76: #define t_cc t_termios.c_cc
77: #define t_ispeed t_termios.c_ispeed
78: #define t_ospeed t_termios.c_ospeed
79:
80: /* These flags are kept in t_state. */
81: #define TS_TTSTOP 0x00100 /* Output paused. */
82:
83: __BEGIN_DECLS
84: int tty_register(struct devio *io, struct tty *tp,
85: void (*output)(struct tty*));
86: int ttyq_getc(struct tty_queue *tq);
87: void ttyq_putc(int c, struct tty_queue *tq);
88: int ttyq_unputc(struct tty_queue *tq);
89:
90: int tty_read(struct tty *tp, char *buf, size_t *nbytes);
91: int tty_write(struct tty *tp, char *buf, size_t *nbyte);
92: int tty_ioctl(struct tty *tp, u_long cmd, void *data);
93: void tty_input(int c, struct tty *tp);
94: __END_DECLS
95:
96: #endif /* KERNEL */
97: #endif /* !_SYS_TTY_H */
CVSweb