| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: puffs_rumpglue.c,v 1.7 2008/09/05 10:42:09 pooka Exp $ */ | | 1 | /* $NetBSD: puffs_rumpglue.c,v 1.8 2008/10/07 23:22:05 pooka Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2008 Antti Kantee. All Rights Reserved. | | 4 | * Copyright (c) 2008 Antti Kantee. All Rights Reserved. |
5 | * | | 5 | * |
6 | * Development of this software was supported by the | | 6 | * Development of this software was supported by the |
7 | * Research Foundation of Helsinki University of Technology | | 7 | * Research Foundation of Helsinki University of Technology |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -19,27 +19,27 @@ | | | @@ -19,27 +19,27 @@ |
19 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 19 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | * SUCH DAMAGE. | | 28 | * SUCH DAMAGE. |
29 | */ | | 29 | */ |
30 | | | 30 | |
31 | #include <sys/cdefs.h> | | 31 | #include <sys/cdefs.h> |
32 | __KERNEL_RCSID(0, "$NetBSD: puffs_rumpglue.c,v 1.7 2008/09/05 10:42:09 pooka Exp $"); | | 32 | __KERNEL_RCSID(0, "$NetBSD: puffs_rumpglue.c,v 1.8 2008/10/07 23:22:05 pooka Exp $"); |
33 | | | 33 | |
34 | #include <sys/param.h> | | 34 | #include <sys/param.h> |
35 | #include <sys/conf.h> | | 35 | #include <sys/conf.h> |
36 | #include <sys/file.h> | | 36 | #include <sys/file.h> |
37 | #include <sys/filedesc.h> | | 37 | #include <sys/filedesc.h> |
38 | #include <sys/kthread.h> | | 38 | #include <sys/kthread.h> |
39 | #include <sys/mount.h> | | 39 | #include <sys/mount.h> |
40 | | | 40 | |
41 | #include <dev/putter/putter.h> | | 41 | #include <dev/putter/putter.h> |
42 | #include <dev/putter/putter_sys.h> | | 42 | #include <dev/putter/putter_sys.h> |
43 | | | 43 | |
44 | #include <rump/rump.h> | | 44 | #include <rump/rump.h> |
45 | #include <rump/rumpuser.h> | | 45 | #include <rump/rumpuser.h> |
| @@ -156,27 +156,29 @@ writethread(void *arg) | | | @@ -156,27 +156,29 @@ writethread(void *arg) |
156 | KASSERT(rv == phdr->pth_framelen); | | 156 | KASSERT(rv == phdr->pth_framelen); |
157 | } | | 157 | } |
158 | out: | | 158 | out: |
159 | | | 159 | |
160 | kthread_exit(0); | | 160 | kthread_exit(0); |
161 | } | | 161 | } |
162 | | | 162 | |
163 | int | | 163 | int |
164 | syspuffs_glueinit(int fd, int *newfd) | | 164 | syspuffs_glueinit(int fd, int *newfd) |
165 | { | | 165 | { |
166 | struct ptargs *pap; | | 166 | struct ptargs *pap; |
167 | int rv; | | 167 | int rv; |
168 | | | 168 | |
169 | rump_init(); | | 169 | if ((rv = rump_init()) != 0) |
| | | 170 | return rv; |
| | | 171 | |
170 | putterattach(); | | 172 | putterattach(); |
171 | rv = puttercdopen(makedev(178, 0), 0, 0, curlwp); | | 173 | rv = puttercdopen(makedev(178, 0), 0, 0, curlwp); |
172 | if (rv && rv != EMOVEFD) | | 174 | if (rv && rv != EMOVEFD) |
173 | return rv; | | 175 | return rv; |
174 | | | 176 | |
175 | pap = kmem_alloc(sizeof(struct ptargs), KM_SLEEP); | | 177 | pap = kmem_alloc(sizeof(struct ptargs), KM_SLEEP); |
176 | pap->comfd = fd; | | 178 | pap->comfd = fd; |
177 | pap->fpfd = curlwp->l_dupfd; | | 179 | pap->fpfd = curlwp->l_dupfd; |
178 | pap->fdp = curlwp->l_proc->p_fd; | | 180 | pap->fdp = curlwp->l_proc->p_fd; |
179 | | | 181 | |
180 | kthread_create(PRI_NONE, 0, NULL, readthread, pap, NULL, "rputter"); | | 182 | kthread_create(PRI_NONE, 0, NULL, readthread, pap, NULL, "rputter"); |
181 | kthread_create(PRI_NONE, 0, NULL, writethread, pap, NULL, "wputter"); | | 183 | kthread_create(PRI_NONE, 0, NULL, writethread, pap, NULL, "wputter"); |
182 | | | 184 | |