diff options
author | ache <ache@FreeBSD.org> | 1995-02-15 22:25:51 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-02-15 22:25:51 +0000 |
commit | b0853153fa5dd9296468413b9e8fcb4d54db7a76 (patch) | |
tree | ae0e45155567ce5004a529abe3ca3eb623634ad9 /sys | |
parent | 135d9b98bd5e1c1b015433403b7c40bb36ee0700 (diff) | |
download | FreeBSD-src-b0853153fa5dd9296468413b9e8fcb4d54db7a76.zip FreeBSD-src-b0853153fa5dd9296468413b9e8fcb4d54db7a76.tar.gz |
Restore deleted in second time my & bde fixes.
UGEN STOP IT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Diffstat (limited to 'sys')
-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 8fd5fc0..0860a3c 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 */ |