summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-02-03 19:58:28 +0000
committered <ed@FreeBSD.org>2009-02-03 19:58:28 +0000
commit85ebf973414dfbc79b1b194bd303e31ad364fc40 (patch)
treef22d7cb17f77953696672862fe82baf97908f1ce /sys/kern/tty.c
parent51fa332ba90cf11592eb8b8774a83ae028729cf8 (diff)
downloadFreeBSD-src-85ebf973414dfbc79b1b194bd303e31ad364fc40.zip
FreeBSD-src-85ebf973414dfbc79b1b194bd303e31ad364fc40.tar.gz
Slightly improve the design of the TTY buffer.
The TTY buffers used the standard <sys/queue.h> lists. Unfortunately they have a big shortcoming. If you want to have a double linked list, but no tail pointer, it's still not possible to obtain the previous element in the list. Inside the buffers we don't need them. This is why I switched to custom linked list macros. The macros will also keep track of the amount of items in the list. Because it doesn't use a sentinel, we can just initialize the queues with zero. In its simplest form (the output queue), we will only keep two references to blocks in the queue, namely the head of the list and the last block in use. All free blocks are stored behind the last block in use. I noticed there was a very subtle bug in the previous code: in a very uncommon corner case, it would uma_zfree() a block in the queue before calling memcpy() to extract the data from the block.
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r--sys/kern/tty.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 84ff66d..25d44e8 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -884,9 +884,6 @@ tty_alloc(struct ttydevsw *tsw, void *sc, struct mtx *mutex)
cv_init(&tp->t_bgwait, "ttybg");
cv_init(&tp->t_dcdwait, "ttydcd");
- ttyinq_init(&tp->t_inq);
- ttyoutq_init(&tp->t_outq);
-
/* Allow drivers to use a custom mutex to lock the TTY. */
if (mutex != NULL) {
tp->t_mtx = mutex;
OpenPOWER on IntegriCloud