Module Name: src
Committed By: pooka
Date: Sun Jan 9 14:10:03 UTC 2011
Modified Files:
src/lib/librumpclient: rumpclient.c
src/lib/librumpuser: rumpuser_sp.c sp_common.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/librumpclient/rumpclient.c
cvs rdiff -u -r1.31 -r1.32 src/lib/librumpuser/rumpuser_sp.c
cvs rdiff -u -r1.20 -r1.21 src/lib/librumpuser/sp_common.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/librumpclient/rumpclient.c
diff -u src/lib/librumpclient/rumpclient.c:1.13 src/lib/librumpclient/rumpclient.c:1.14
--- src/lib/librumpclient/rumpclient.c:1.13 Fri Jan 7 19:37:51 2011
+++ src/lib/librumpclient/rumpclient.c Sun Jan 9 14:10:03 2011
@@ -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) {
Index: src/lib/librumpuser/rumpuser_sp.c
diff -u src/lib/librumpuser/rumpuser_sp.c:1.31 src/lib/librumpuser/rumpuser_sp.c:1.32
--- src/lib/librumpuser/rumpuser_sp.c:1.31 Thu Jan 6 06:57:14 2011
+++ src/lib/librumpuser/rumpuser_sp.c Sun Jan 9 14:10:03 2011
@@ -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) {
Index: src/lib/librumpuser/sp_common.c
diff -u src/lib/librumpuser/sp_common.c:1.20 src/lib/librumpuser/sp_common.c:1.21
--- src/lib/librumpuser/sp_common.c:1.20 Fri Jan 7 19:37:52 2011
+++ src/lib/librumpuser/sp_common.c Sun Jan 9 14:10:03 2011
@@ -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;