Mon Feb 21 18:50:22 2011 UTC ()
add command line options for kernel memory allocation limit and bootverbose


(pooka)
diff -r1.15 -r1.16 src/usr.bin/rump_allserver/rump_allserver.1
diff -r1.19 -r1.20 src/usr.bin/rump_allserver/rump_allserver.c

cvs diff -r1.15 -r1.16 src/usr.bin/rump_allserver/rump_allserver.1 (expand / switch to unified diff)

--- src/usr.bin/rump_allserver/rump_allserver.1 2011/02/18 09:54:03 1.15
+++ src/usr.bin/rump_allserver/rump_allserver.1 2011/02/21 18:50:21 1.16
@@ -1,39 +1,39 @@ @@ -1,39 +1,39 @@
1.\" $NetBSD: rump_allserver.1,v 1.15 2011/02/18 09:54:03 pooka Exp $ 1.\" $NetBSD: rump_allserver.1,v 1.16 2011/02/21 18:50:21 pooka Exp $
2.\" 2.\"
3.\" Copyright (c) 2010 Antti Kantee. All rights reserved. 3.\" Copyright (c) 2010 Antti Kantee. All rights reserved.
4.\" 4.\"
5.\" Redistribution and use in source and binary forms, with or without 5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions 6.\" modification, are permitted provided that the following conditions
7.\" are met: 7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright 8.\" 1. Redistributions of source code must retain the above copyright
9.\" notice, this list of conditions and the following disclaimer. 9.\" notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\" notice, this list of conditions and the following disclaimer in the 11.\" notice, this list of conditions and the following disclaimer in the
12.\" documentation and/or other materials provided with the distribution. 12.\" documentation and/or other materials provided with the distribution.
13.\" 13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE. 24.\" SUCH DAMAGE.
25.\" 25.\"
26.Dd February 17, 2011 26.Dd February 21, 2011
27.Dt RUMP_SERVER 1 27.Dt RUMP_SERVER 1
28.Os 28.Os
29.Sh NAME 29.Sh NAME
30.Nm rump_server , 30.Nm rump_server ,
31.Nm rump_allserver 31.Nm rump_allserver
32.Nd rump kernel server 32.Nd rump kernel server
33.Sh SYNOPSIS 33.Sh SYNOPSIS
34.Nm 34.Nm
35.Op Fl s 35.Op Fl s
36.Op Fl c Ar ncpu 36.Op Fl c Ar ncpu
37.Op Fl d Ar drivespec 37.Op Fl d Ar drivespec
38.Op Fl l Ar library 38.Op Fl l Ar library
39.Op Fl m Ar module 39.Op Fl m Ar module
@@ -149,32 +149,43 @@ will also be initialized. @@ -149,32 +149,43 @@ will also be initialized.
149.Pp 149.Pp
150The argument 150The argument
151.Ar library 151.Ar library
152can contain a full path or a filename, in which case the standard 152can contain a full path or a filename, in which case the standard
153dynamic library search path will be used. 153dynamic library search path will be used.
154Libraries are loaded in the order they are given. 154Libraries are loaded in the order they are given.
155Dependencies are not autoloaded, and the order must be specified 155Dependencies are not autoloaded, and the order must be specified
156correctly. 156correctly.
157.It Fl m Ar module 157.It Fl m Ar module
158Load and link a kernel module after the rump kernel is initialized. 158Load and link a kernel module after the rump kernel is initialized.
159For this to work, the rump kernel must include the vfs faction, 159For this to work, the rump kernel must include the vfs faction,
160since the module is loaded using kernel vfs code (see 160since the module is loaded using kernel vfs code (see
161.Sx EXAMPLES ) . 161.Sx EXAMPLES ) .
 162.It Fl r Ar total_ram
 163Sets the limit of kernel memory allocatable by the server to
 164.Ar total_ram
 165as opposed to the default which allows the server to allocate as much
 166memory as the host will give it.
 167This parameter is especially useful for VFS servers, since by
 168default the virtual file system will attempt to consume as much
 169memory as it can, and accessing large files can cause an excessive
 170amount of memory to be used as file system cache.
162.It Fl s 171.It Fl s
163Do not detach from the terminal. 172Do not detach from the terminal.
164By default, 173By default,
165.Nm 174.Nm
166detaches from the terminal once the service is running on 175detaches from the terminal once the service is running on
167.Ar url . 176.Ar url .
 177.It Fl v
 178Set bootverbose.
168.El 179.El
169.Pp 180.Pp
170After use, 181After use,
171.Nm 182.Nm
172can be made to exit using 183can be made to exit using
173.Xr rump.halt 1 . 184.Xr rump.halt 1 .
174.Sh EXAMPLES 185.Sh EXAMPLES
175Start a server and load the tmpfs file system module, and halt the 186Start a server and load the tmpfs file system module, and halt the
176server immediately afterwards: 187server immediately afterwards:
177.Bd -literal -offset indent 188.Bd -literal -offset indent
178$ rump_server -lrumpvfs -m /modules/tmpfs.kmod unix://sock 189$ rump_server -lrumpvfs -m /modules/tmpfs.kmod unix://sock
179$ env RUMP_SERVER=unix://sock rump.halt 190$ env RUMP_SERVER=unix://sock rump.halt
180.Ed 191.Ed
@@ -182,17 +193,22 @@ $ env RUMP_SERVER=unix://sock rump.halt @@ -182,17 +193,22 @@ $ env RUMP_SERVER=unix://sock rump.halt
182Start a server with the one gigabyte host file 193Start a server with the one gigabyte host file
183.Pa dk.img 194.Pa dk.img
184mapped as the block device 195mapped as the block device
185.Pa /dev/dk 196.Pa /dev/dk
186in the rump kernel. 197in the rump kernel.
187.Bd -literal -offset indent 198.Bd -literal -offset indent
188$ rump_allserver -d key=/dev/dk,hostpath=dk.img,size=1g unix://sock 199$ rump_allserver -d key=/dev/dk,hostpath=dk.img,size=1g unix://sock
189.Ed 200.Ed
190.Pp 201.Pp
191Start a server which listens on INADDR_ANY port 3755 202Start a server which listens on INADDR_ANY port 3755
192.Bd -literal -offset indent 203.Bd -literal -offset indent
193$ rump_server tcp://0:3755/ 204$ rump_server tcp://0:3755/
194.Ed 205.Ed
 206.Pp
 207Start a FFS server with a 16MB kernel memory limit.
 208.Bd -literal -offset indent
 209$ rump_server -lrumpvfs -lrumpfs_ffs -r 16m unix:///tmp/ffs_server
 210.Ed
195.Sh SEE ALSO 211.Sh SEE ALSO
196.Xr rump.halt 1 , 212.Xr rump.halt 1 ,
197.Xr dlopen 3 , 213.Xr dlopen 3 ,
198.Xr rump 3 214.Xr rump 3

cvs diff -r1.19 -r1.20 src/usr.bin/rump_allserver/rump_allserver.c (expand / switch to unified diff)

--- src/usr.bin/rump_allserver/rump_allserver.c 2011/02/18 09:54:03 1.19
+++ src/usr.bin/rump_allserver/rump_allserver.c 2011/02/21 18:50:21 1.20
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rump_allserver.c,v 1.19 2011/02/18 09:54:03 pooka Exp $ */ 1/* $NetBSD: rump_allserver.c,v 1.20 2011/02/21 18:50:21 pooka Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. 4 * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE. 25 * SUCH DAMAGE.
26 */ 26 */
27 27
28#include <sys/cdefs.h> 28#include <sys/cdefs.h>
29#ifndef lint 29#ifndef lint
30__RCSID("$NetBSD: rump_allserver.c,v 1.19 2011/02/18 09:54:03 pooka Exp $"); 30__RCSID("$NetBSD: rump_allserver.c,v 1.20 2011/02/21 18:50:21 pooka Exp $");
31#endif /* !lint */ 31#endif /* !lint */
32 32
33#include <sys/types.h> 33#include <sys/types.h>
34#include <sys/disklabel.h> 34#include <sys/disklabel.h>
35#include <sys/signal.h> 35#include <sys/signal.h>
36#include <sys/module.h> 36#include <sys/module.h>
37 37
38#include <rump/rump.h> 38#include <rump/rump.h>
39#include <rump/rump_syscalls.h> 39#include <rump/rump_syscalls.h>
40 40
41#include <dlfcn.h> 41#include <dlfcn.h>
42#include <err.h> 42#include <err.h>
43#include <errno.h> 43#include <errno.h>
@@ -116,27 +116,27 @@ main(int argc, char *argv[]) @@ -116,27 +116,27 @@ main(int argc, char *argv[])
116{ 116{
117 const char *serverurl; 117 const char *serverurl;
118 char **modarray = NULL; 118 char **modarray = NULL;
119 unsigned nmods = 0, curmod = 0, i; 119 unsigned nmods = 0, curmod = 0, i;
120 struct etfsreg *etfs = NULL; 120 struct etfsreg *etfs = NULL;
121 unsigned netfs = 0, curetfs = 0; 121 unsigned netfs = 0, curetfs = 0;
122 int error; 122 int error;
123 int ch, sflag; 123 int ch, sflag;
124 int ncpu; 124 int ncpu;
125 125
126 setprogname(argv[0]); 126 setprogname(argv[0]);
127 127
128 sflag = 0; 128 sflag = 0;
129 while ((ch = getopt(argc, argv, "c:d:l:m:s")) != -1) { 129 while ((ch = getopt(argc, argv, "c:d:l:m:r:sv")) != -1) {
130 switch (ch) { 130 switch (ch) {
131 case 'c': 131 case 'c':
132 ncpu = atoi(optarg); 132 ncpu = atoi(optarg);
133 /* XXX: MAXCPUS is from host, not from kernel */ 133 /* XXX: MAXCPUS is from host, not from kernel */
134 if (ncpu < 1 || ncpu > MAXCPUS) 134 if (ncpu < 1 || ncpu > MAXCPUS)
135 err(1, "CPU count needs to be between " 135 err(1, "CPU count needs to be between "
136 "1 and %d\n", MAXCPUS); 136 "1 and %d\n", MAXCPUS);
137 setenv("RUMP_NCPU", optarg, 1); 137 setenv("RUMP_NCPU", optarg, 1);
138 break; 138 break;
139 case 'd': { 139 case 'd': {
140 char *options, *value; 140 char *options, *value;
141 char *key, *hostpath; 141 char *key, *hostpath;
142 long long flen, foffset; 142 long long flen, foffset;
@@ -289,29 +289,35 @@ main(int argc, char *argv[]) @@ -289,29 +289,35 @@ main(int argc, char *argv[])
289 } 289 }
290 } 290 }
291 break; 291 break;
292 case 'm': 292 case 'm':
293 if (nmods - curmod == 0) { 293 if (nmods - curmod == 0) {
294 modarray = realloc(modarray, 294 modarray = realloc(modarray,
295 (nmods+16) * sizeof(char *)); 295 (nmods+16) * sizeof(char *));
296 if (modarray == NULL) 296 if (modarray == NULL)
297 err(1, "realloc"); 297 err(1, "realloc");
298 nmods += 16; 298 nmods += 16;
299 } 299 }
300 modarray[curmod++] = optarg; 300 modarray[curmod++] = optarg;
301 break; 301 break;
 302 case 'r':
 303 setenv("RUMP_MEMLIMIT", optarg, 1);
 304 break;
302 case 's': 305 case 's':
303 sflag = 1; 306 sflag = 1;
304 break; 307 break;
 308 case 'v':
 309 setenv("RUMP_VERBOSE", "1", 1);
 310 break;
305 default: 311 default:
306 usage(); 312 usage();
307 /*NOTREACHED*/ 313 /*NOTREACHED*/
308 } 314 }
309 } 315 }
310 316
311 argc -= optind; 317 argc -= optind;
312 argv += optind; 318 argv += optind;
313 319
314 if (argc != 1) 320 if (argc != 1)
315 usage(); 321 usage();
316 322
317 serverurl = argv[0]; 323 serverurl = argv[0];