Date: Tue, 3 Feb 2009 19:58:28 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/sys/dev/snp snp.c src/sys/kern tty.c tty_inq.c tty_outq.c src/sys/sys ttyqueue.h Message-ID: <200902031959.n13Jx5bv069093@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
ed 2009-02-03 19:58:28 UTC
FreeBSD src repository
Modified files:
sys/dev/snp snp.c
sys/kern tty.c tty_inq.c tty_outq.c
sys/sys ttyqueue.h
Log:
SVN rev 188096 on 2009-02-03 19:58:28Z by ed
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.
Revision Changes Path
1.113 +0 -1 src/sys/dev/snp/snp.c
1.307 +0 -3 src/sys/kern/tty.c
1.3 +50 -28 src/sys/kern/tty_inq.c
1.4 +52 -42 src/sys/kern/tty_outq.c
1.4 +17 -31 src/sys/sys/ttyqueue.h
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902031959.n13Jx5bv069093>
