g/c code which is unused in the server
This commit is contained in:
parent
7bb48ed5ab
commit
52fffe2163
@ -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 @@ static pthread_mutex_t pfmtx;
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
|
@ -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 @@ putwait(struct spclient *spc, struct respwait *rw, struct rsp_hdr *rhdr)
|
||||
{
|
||||
|
||||
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 @@ static void
|
||||
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 @@ kickwaiter(struct spclient *spc)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user