diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 1995-02-15 22:25:51 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 1995-02-15 22:25:51 +0000 |
commit | 93a56d1fd10aec4ec7cc4b621b551c13f6411c85 (patch) | |
tree | ae0e45155567ce5004a529abe3ca3eb623634ad9 /sys/kern/tty.c | |
parent | d69128d862acd91e82ab1c134ef48f8bc9c52826 (diff) | |
download | src-93a56d1fd10aec4ec7cc4b621b551c13f6411c85.tar.gz src-93a56d1fd10aec4ec7cc4b621b551c13f6411c85.zip |
Notes
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r-- | sys/kern/tty.c | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 8fd5fc0e7873..0860a3c95876 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)tty.c 8.8 (Berkeley) 1/21/94 - * $Id: tty.c,v 1.25 1995/02/14 21:21:25 ugen Exp $ + * $Id: tty.c,v 1.27 1995/02/15 18:41:56 ugen Exp $ */ #include "snp.h" @@ -230,6 +230,22 @@ ttyclose(tp) ((c) == '\n' || (((c) == cc[VEOF] || \ (c) == cc[VEOL] || (c) == cc[VEOL2]) && (c) != _POSIX_VDISABLE)) +/*- + * TODO: + * o Fix races for sending the start char in ttyflush(). + * o Handle inter-byte timeout for "MIN > 0, TIME > 0" in ttselect(). + * With luck, there will be MIN chars before select() returns(). + * o Handle CLOCAL consistently for ptys. Perhaps disallow setting it. + * o Don't allow input in TS_ZOMBIE case. It would be visible through + * FIONREAD. + * o Do the new sio locking stuff here and use it to avoid special + * case for EXTPROC? + * o Lock PENDIN too? + * o Move EXTPROC and/or PENDIN to t_state? + * o Wrap most of ttioctl in spltty/splx. + * o Implement TIOCNOTTY or remove it from <sys/ioctl.h>. + */ + /* * Process input of a single character received on a tty. @@ -1016,6 +1032,8 @@ ttywait(tp) break; } } + if (!error && (tp->t_outq.c_cc || ISSET(tp->t_state, TS_BUSY))) + error = EIO; splx(s); return (error); } @@ -1147,10 +1165,8 @@ ttylclose(tp, flag) int flag; { - if (flag & IO_NDELAY) + if ((flag & IO_NDELAY) || ttywflush(tp)) ttyflush(tp, FREAD | FWRITE); - else - ttywflush(tp); return (0); } @@ -1609,7 +1625,6 @@ loop: if (ISSET(tp->t_state, TS_SNOOP) && tp->t_sc != NULL) snpin((struct snoop *)tp->t_sc, cp, cc); #endif - } /* * If nothing fancy need be done, grab those characters we @@ -2119,37 +2134,33 @@ ttysleep(tp, chan, pri, wmesg, timo) } /* - * Allocate a tty structure and its associated buffers. + * XXX this is usable but not useful or used. ttselect() requires an array + * of tty structs. Most tty drivers have ifdefs for using ttymalloc() but + * assume a different interface. + */ +/* + * Allocate a tty struct. Clists in the struct will be allocated by + * ttyopen(). */ struct tty * ttymalloc() { struct tty *tp; - MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK); + tp = malloc(sizeof *tp, M_TTYS, M_WAITOK); bzero(tp, sizeof *tp); - - /* - * Initialize or restore a cblock allocation policy suitable for - * the standard line discipline. - */ - clist_alloc_cblocks(&tp->t_canq, TTYHOG, 512); - clist_alloc_cblocks(&tp->t_outq, TTMAXHIWAT + 200, 512); - clist_alloc_cblocks(&tp->t_rawq, TTYHOG, 512); - - return(tp); + return (tp); } +#if 0 /* XXX not yet usable: session leader holds a ref (see kern_exit.c). */ /* - * Free a tty structure and its buffers. + * Free a tty struct. Clists in the struct should have been freed by + * ttyclose(). */ void ttyfree(tp) -struct tty *tp; + struct tty *tp; { - clist_free_cblocks(&tp->t_canq); - clist_free_cblocks(&tp->t_outq); - clist_free_cblocks(&tp->t_rawq); - FREE(tp, M_TTYS); + free(tp, M_TTYS); } - +#endif /* 0 */ |