Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/librumpuser Run different clients (different sockets) in...
details: https://anonhg.NetBSD.org/src/rev/0903f59efc7a
branches: trunk
changeset: 758248:0903f59efc7a
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Oct 28 14:37:29 2010 +0000
description:
Run different clients (different sockets) in different processes
inside the rump kernel. Now different host processes can no longer
step on each other inside the rump kernel.
diffstat:
lib/librumpuser/rumpuser_sp.c | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
diffs (96 lines):
diff -r 6bf5f7f958aa -r 0903f59efc7a lib/librumpuser/rumpuser_sp.c
--- a/lib/librumpuser/rumpuser_sp.c Thu Oct 28 14:36:04 2010 +0000
+++ b/lib/librumpuser/rumpuser_sp.c Thu Oct 28 14:37:29 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser_sp.c,v 1.1 2010/10/27 20:44:50 pooka Exp $ */
+/* $NetBSD: rumpuser_sp.c,v 1.2 2010/10/28 14:37:29 pooka Exp $ */
/*
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: rumpuser_sp.c,v 1.1 2010/10/27 20:44:50 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_sp.c,v 1.2 2010/10/28 14:37:29 pooka Exp $");
#include <sys/types.h>
#include <sys/mman.h>
@@ -121,6 +121,7 @@
struct spclient {
int spc_fd;
+ struct lwp *spc_lwp;
/* incoming */
struct rsp_hdr spc_hdr;
@@ -312,13 +313,16 @@
}
static void
-serv_handle_disco(unsigned int idx)
+serv_handledisco(unsigned int idx)
{
struct spclient *spc = &spclist[idx];
int fd = spc->spc_fd;
DPRINTF(("rump_sp: disconnecting [%u]\n", idx));
+ rump_pub_lwproc_switch(spc->spc_lwp);
+ rump_pub_lwproc_releaselwp();
+
free(spc->spc_buf);
memset(spc, 0, sizeof(*spc));
close(fd);
@@ -369,10 +373,15 @@
return error;
}
+ if ((error = rump_pub_lwproc_newproc()) != 0) {
+ close(newfd);
+ return error;
+ }
+
/* find empty slot the simple way */
for (i = 0; i < MAXCLI; i++) {
if (pfdlist[i].fd == -1)
- break;
+ break;
}
assert(i < MAXCLI);
@@ -380,10 +389,14 @@
pfdlist[i].fd = newfd;
spclist[i].spc_fd = newfd;
+ spclist[i].spc_lwp = rump_pub_lwproc_curlwp();
if (maxidx < i)
maxidx = i;
- DPRINTF(("rump_sp: added new connection at idx %u\n", i));
+ DPRINTF(("rump_sp: added new connection at idx %u, pid %d\n",
+ i, rump_sys_getpid()));
+
+ rump_pub_lwproc_switch(NULL);
return 0;
}
@@ -399,7 +412,9 @@
sysnum, 0));
pthread_setspecific(spclient_tls, spc);
+ rump_pub_lwproc_switch(spc->spc_lwp);
rv = rump_pub_syscall(sysnum, data, retval);
+ rump_pub_lwproc_switch(NULL);
pthread_setspecific(spclient_tls, NULL);
send_syscall_resp(spc, rhdr->rsp_reqno, rv, retval);
@@ -812,7 +827,7 @@
case 0:
break;
case -1:
- serv_handle_disco(idx);
+ serv_handledisco(idx);
break;
default:
spc->spc_off = 0;
Home |
Main Index |
Thread Index |
Old Index