ia64/xen-unstable

changeset 6777:4d018790ff8a

Fixed consoled race condition.
Signed-off by: Andy Peace <andrew.peace@xensource.com>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Sep 13 10:13:52 2005 +0000 (2005-09-13)
parents 0fad07d67e75
children bd951d23d713
files tools/console/daemon/io.c
line diff
     1.1 --- a/tools/console/daemon/io.c	Tue Sep 13 10:05:49 2005 +0000
     1.2 +++ b/tools/console/daemon/io.c	Tue Sep 13 10:13:52 2005 +0000
     1.3 @@ -87,6 +87,7 @@ static void buffer_append(struct domain 
     1.4  	struct buffer *buffer = &dom->buffer;
     1.5  	struct ring_head *ring = (struct ring_head *)dom->page;
     1.6  	size_t size;
     1.7 +	u32 oldcons;
     1.8  
     1.9  	while ((size = ring->prod - ring->cons) != 0) {
    1.10  		if ((buffer->capacity - buffer->size) < size) {
    1.11 @@ -98,7 +99,8 @@ static void buffer_append(struct domain 
    1.12  			}
    1.13  		}
    1.14  
    1.15 -		while (ring->cons < ring->prod) {
    1.16 +		oldcons = ring->cons;
    1.17 +		while (ring->cons < (oldcons + size)) {
    1.18  			buffer->data[buffer->size] =
    1.19  				ring->buf[XENCONS_IDX(ring->cons)];
    1.20  			buffer->size++;