Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/librumpuser g/c code which is unused in the server
details: https://anonhg.NetBSD.org/src/rev/2da49223d950
branches: trunk
changeset: 760654:2da49223d950
user: pooka <pooka%NetBSD.org@localhost>
date: Mon Jan 10 11:57:53 2011 +0000
description:
g/c code which is unused in the server
diffstat:
lib/librumpuser/rumpuser_sp.c | 61 +++---------------------------------------
lib/librumpuser/sp_common.c | 8 ++---
2 files changed, 8 insertions(+), 61 deletions(-)
diffs (126 lines):
diff -r 088b2269d4f4 -r 2da49223d950 lib/librumpuser/rumpuser_sp.c
--- a/lib/librumpuser/rumpuser_sp.c Mon Jan 10 11:18:14 2011 +0000
+++ b/lib/librumpuser/rumpuser_sp.c Mon Jan 10 11:57:53 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser_sp.c,v 1.32 2011/01/09 14:10:03 pooka Exp $ */
+/* $NetBSD: rumpuser_sp.c,v 1.33 2011/01/10 11:57:53 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.32 2011/01/09 14:10:03 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_sp.c,v 1.33 2011/01/10 11:57:53 pooka Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -99,68 +99,17 @@
/*
* This version is for the server. It's optimized for multiple threads
- * and is *NOT* reentrant wrt to signals
+ * and is *NOT* reentrant wrt to signals.
*/
static int
waitresp(struct spclient *spc, struct respwait *rw)
{
- struct pollfd pfd;
int rv = 0;
sendunlockl(spc);
-
- 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) {
- int gotresp;
-
- spc->spc_istatus = SPCSTATUS_BUSY;
- pthread_mutex_unlock(&spc->spc_mtx);
-
- pfd.fd = spc->spc_fd;
- pfd.events = POLLIN;
-
- for (gotresp = 0; !gotresp; ) {
- switch (readframe(spc)) {
- case 0:
- poll(&pfd, 1, INFTIM);
- continue;
- case -1:
- rv = errno;
- spc->spc_state = SPCSTATE_DYING;
- goto cleanup;
- default:
- break;
- }
-
- switch (spc->spc_hdr.rsp_class) {
- case RUMPSP_RESP:
- case RUMPSP_ERROR:
- kickwaiter(spc);
- gotresp = spc->spc_hdr.rsp_reqno ==
- rw->rw_reqno;
- break;
- case RUMPSP_REQ:
- handlereq(spc);
- break;
- default:
- /* panic */
- break;
- }
- }
- cleanup:
- pthread_mutex_lock(&spc->spc_mtx);
- if (spc->spc_istatus == SPCSTATUS_WANTED)
- kickall(spc);
- spc->spc_istatus = SPCSTATUS_FREE;
- } else {
- spc->spc_istatus = SPCSTATUS_WANTED;
- pthread_cond_wait(&rw->rw_cv, &spc->spc_mtx);
- }
+ while (!rw->rw_done && spc->spc_state != SPCSTATE_DYING) {
+ pthread_cond_wait(&rw->rw_cv, &spc->spc_mtx);
}
-
TAILQ_REMOVE(&spc->spc_respwait, rw, rw_entries);
pthread_mutex_unlock(&spc->spc_mtx);
diff -r 088b2269d4f4 -r 2da49223d950 lib/librumpuser/sp_common.c
--- a/lib/librumpuser/sp_common.c Mon Jan 10 11:18:14 2011 +0000
+++ b/lib/librumpuser/sp_common.c Mon Jan 10 11:57:53 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sp_common.c,v 1.21 2011/01/09 14:10:03 pooka Exp $ */
+/* $NetBSD: sp_common.c,v 1.22 2011/01/10 11:57:53 pooka Exp $ */
/*
* Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
@@ -290,7 +290,7 @@
{
rw->rw_data = NULL;
- rw->rw_dlen = rw->rw_done = 0;
+ rw->rw_dlen = rw->rw_done = rw->rw_error = 0;
pthread_cond_init(&rw->rw_cv, NULL);
pthread_mutex_lock(&spc->spc_mtx);
@@ -315,7 +315,7 @@
kickwaiter(struct spclient *spc)
{
struct respwait *rw;
- int error;
+ int error = 0;
pthread_mutex_lock(&spc->spc_mtx);
TAILQ_FOREACH(rw, &spc->spc_respwait, rw_entries) {
@@ -334,8 +334,6 @@
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;
- } else {
- error = rw->rw_error = 0;
}
pthread_cond_signal(&rw->rw_cv);
pthread_mutex_unlock(&spc->spc_mtx);
Home |
Main Index |
Thread Index |
Old Index