Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib Separate rw_data and rw_done. Otherwise we don't get wa...
details: https://anonhg.NetBSD.org/src/rev/670fea919175
branches: trunk
changeset: 760617:670fea919175
user: pooka <pooka%NetBSD.org@localhost>
date: Sun Jan 09 14:10:03 2011 +0000
description:
Separate rw_data and rw_done. Otherwise we don't get wakeups for
requests which have a 0-length response (such as copyin 0/0).
This change makes links(1) work against a rump kernel which contains
rumpnet_local. The presence of unix domain sockets caused links
to select() with 0 fds and a timeout, and because copyin never woke
up in the kernel the application blocked indefinitely.
diffstat:
lib/librumpclient/rumpclient.c | 4 ++--
lib/librumpuser/rumpuser_sp.c | 6 +++---
lib/librumpuser/sp_common.c | 6 ++++--
3 files changed, 9 insertions(+), 7 deletions(-)
diffs (79 lines):
diff -r b1c1ef6c00ff -r 670fea919175 lib/librumpclient/rumpclient.c
--- a/lib/librumpclient/rumpclient.c Sun Jan 09 13:49:57 2011 +0000
+++ b/lib/librumpclient/rumpclient.c Sun Jan 09 14:10:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpclient.c,v 1.13 2011/01/07 19:37:51 pooka Exp $ */
+/* $NetBSD: rumpclient.c,v 1.14 2011/01/09 14:10:03 pooka Exp $ */
/*
* Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
@@ -99,7 +99,7 @@
sendunlockl(spc);
rw->rw_error = 0;
- while (rw->rw_data == NULL && rw->rw_error == 0
+ while (!rw->rw_done && rw->rw_error == 0
&& spc->spc_state != SPCSTATE_DYING){
/* are we free to receive? */
if (spc->spc_istatus == SPCSTATUS_FREE) {
diff -r b1c1ef6c00ff -r 670fea919175 lib/librumpuser/rumpuser_sp.c
--- a/lib/librumpuser/rumpuser_sp.c Sun Jan 09 13:49:57 2011 +0000
+++ b/lib/librumpuser/rumpuser_sp.c Sun Jan 09 14:10:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser_sp.c,v 1.31 2011/01/06 06:57:14 pooka Exp $ */
+/* $NetBSD: rumpuser_sp.c,v 1.32 2011/01/09 14:10:03 pooka Exp $ */
/*
* Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: rumpuser_sp.c,v 1.31 2011/01/06 06:57:14 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_sp.c,v 1.32 2011/01/09 14:10:03 pooka Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -110,7 +110,7 @@
sendunlockl(spc);
rw->rw_error = 0;
- while (rw->rw_data == NULL && rw->rw_error == 0
+ while (!rw->rw_done && rw->rw_error == 0
&& spc->spc_state != SPCSTATE_DYING){
/* are we free to receive? */
if (spc->spc_istatus == SPCSTATUS_FREE) {
diff -r b1c1ef6c00ff -r 670fea919175 lib/librumpuser/sp_common.c
--- a/lib/librumpuser/sp_common.c Sun Jan 09 13:49:57 2011 +0000
+++ b/lib/librumpuser/sp_common.c Sun Jan 09 14:10:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sp_common.c,v 1.20 2011/01/07 19:37:52 pooka Exp $ */
+/* $NetBSD: sp_common.c,v 1.21 2011/01/09 14:10:03 pooka Exp $ */
/*
* Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
@@ -142,6 +142,7 @@
uint64_t rw_reqno;
void *rw_data;
size_t rw_dlen;
+ int rw_done;
int rw_error;
pthread_cond_t rw_cv;
@@ -289,7 +290,7 @@
{
rw->rw_data = NULL;
- rw->rw_dlen = 0;
+ rw->rw_dlen = rw->rw_done = 0;
pthread_cond_init(&rw->rw_cv, NULL);
pthread_mutex_lock(&spc->spc_mtx);
@@ -329,6 +330,7 @@
}
DPRINTF(("rump_sp: client %p woke up waiter at %p\n", spc, rw));
rw->rw_data = spc->spc_buf;
+ rw->rw_done = 1;
rw->rw_dlen = (size_t)(spc->spc_off - HDRSZ);
if (spc->spc_hdr.rsp_class == RUMPSP_ERROR) {
error = rw->rw_error = spc->spc_hdr.rsp_error;
Home |
Main Index |
Thread Index |
Old Index