diff options
author | jkh <jkh@FreeBSD.org> | 1995-02-09 11:13:30 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-02-09 11:13:30 +0000 |
commit | bf79ed40a3a657cfe25ca11863fed898bf99862e (patch) | |
tree | a7099734b8970cdbd03a0579dddc0fa62040f465 /sys/kern/tty.c | |
parent | 2f624e8b5e33f8fd07401a2da80f44a864d9cab3 (diff) | |
download | FreeBSD-src-bf79ed40a3a657cfe25ca11863fed898bf99862e.zip FreeBSD-src-bf79ed40a3a657cfe25ca11863fed898bf99862e.tar.gz |
>32 PTY support
Submitted by: Heikki Suonsivu <hsu@cs.hut.fi>
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r-- | sys/kern/tty.c | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 16b86ed..0576853 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.19 1995/01/30 06:16:59 bde Exp $ + * $Id: tty.c,v 1.20 1995/02/08 22:02:02 bde Exp $ */ #include <sys/param.h> @@ -55,11 +55,11 @@ #include <sys/syslog.h> #include <sys/signalvar.h> #include <sys/resourcevar.h> +#include <sys/malloc.h> #include <vm/vm.h> static int proc_compare __P((struct proc *p1, struct proc *p2)); -static int ttnread __P((struct tty *)); static void ttyblock __P((struct tty *tp)); static void ttyecho __P((int, struct tty *tp)); static void ttyrubo __P((struct tty *, int)); @@ -960,7 +960,11 @@ win: splx(s); return (0); } -static int +/* + * This is now exported to the cy driver as well; if you hack this code, + * then be sure to keep /sys/i386/isa/cy.c properly advised! -jkh + */ +int ttnread(tp) struct tty *tp; { @@ -2097,3 +2101,39 @@ ttysleep(tp, chan, pri, wmesg, timo) return (error); return (tp->t_gen == gen ? 0 : ERESTART); } + +/* + * Allocate a tty structure and its associated buffers. + */ +struct tty * +ttymalloc() +{ + struct tty *tp; + + MALLOC(tp, struct tty *, sizeof(struct tty), 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); +} + +/* + * Free a tty structure and its buffers. + */ +void +ttyfree(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); +} + |