ia64/xen-unstable

changeset 5875:052208a34902

Fix bug where watch messages doesn't go out. Also change xs_test
to more closely represent xenbus behaviour so we can see the bug.
Signed-off-by: Rusty Russel <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Jul 26 15:23:50 2005 +0000 (2005-07-26)
parents 2ae19537f615
children b9903985e9b6
files tools/xenstore/xenstored_core.c tools/xenstore/xs_test.c
line diff
     1.1 --- a/tools/xenstore/xenstored_core.c	Tue Jul 26 15:21:32 2005 +0000
     1.2 +++ b/tools/xenstore/xenstored_core.c	Tue Jul 26 15:23:50 2005 +0000
     1.3 @@ -253,7 +253,7 @@ static bool write_message(struct connect
     1.4  		out->used = 0;
     1.5  
     1.6  		/* Second write might block if non-zero. */
     1.7 -		if (out->hdr.msg.len)
     1.8 +		if (out->hdr.msg.len && !conn->domain)
     1.9  			return true;
    1.10  	}
    1.11  
     2.1 --- a/tools/xenstore/xs_test.c	Tue Jul 26 15:21:32 2005 +0000
     2.2 +++ b/tools/xenstore/xs_test.c	Tue Jul 26 15:23:50 2005 +0000
     2.3 @@ -85,6 +85,14 @@ static const void *get_input_chunk(const
     2.4  	return buf + h->read;
     2.5  }
     2.6  
     2.7 +static int output_avail(struct ringbuf_head *out)
     2.8 +{
     2.9 +	unsigned int avail;
    2.10 +
    2.11 +	get_output_chunk(out, out->buf, &avail);
    2.12 +	return avail != 0;
    2.13 +}
    2.14 +
    2.15  static void update_output_chunk(struct ringbuf_head *h, uint32_t len)
    2.16  {
    2.17  	h->write += len;
    2.18 @@ -104,10 +112,12 @@ static bool read_all_shmem(int fd __attr
    2.19  			   void *data, unsigned int len)
    2.20  {
    2.21  	unsigned int avail;
    2.22 +	int was_full;
    2.23  
    2.24  	if (!check_buffer(in))
    2.25  		barf("Corrupt buffer");
    2.26  
    2.27 +	was_full = !output_avail(in);
    2.28  	while (len) {
    2.29  		const void *src = get_input_chunk(in, in->buf, &avail);
    2.30  		if (avail > len)
    2.31 @@ -119,7 +129,8 @@ static bool read_all_shmem(int fd __attr
    2.32  	}
    2.33  
    2.34  	/* Tell other end we read something. */
    2.35 -	kill(daemon_pid, SIGUSR2);
    2.36 +	if (was_full)
    2.37 +		kill(daemon_pid, SIGUSR2);
    2.38  	return true;
    2.39  }
    2.40