Module Name: src Committed By: pooka Date: Sun Dec 12 12:48:33 UTC 2010
Modified Files: src/distrib/sets/lists/base: mi src/distrib/sets/lists/comp: mi src/distrib/sets/lists/man: mi src/usr.bin: Makefile Added Files: src/usr.bin/rump_halt: Makefile rump.halt.1 rump.halt.c Log Message: utility to halt a rump kernel To generate a diff of this commit: cvs rdiff -u -r1.898 -r1.899 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.1535 -r1.1536 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.1262 -r1.1263 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.194 -r1.195 src/usr.bin/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/rump_halt/Makefile \ src/usr.bin/rump_halt/rump.halt.1 src/usr.bin/rump_halt/rump.halt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/base/mi diff -u src/distrib/sets/lists/base/mi:1.898 src/distrib/sets/lists/base/mi:1.899 --- src/distrib/sets/lists/base/mi:1.898 Wed Dec 8 23:56:01 2010 +++ src/distrib/sets/lists/base/mi Sun Dec 12 12:48:31 2010 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.898 2010/12/08 23:56:01 njoly Exp $ +# $NetBSD: mi,v 1.899 2010/12/12 12:48:31 pooka Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -588,6 +588,7 @@ ./usr/bin/rs base-util-bin ./usr/bin/rsh base-netutil-bin ./usr/bin/rump_allserver base-util-bin +./usr/bin/rump.halt base-util-bin ./usr/bin/rup base-netutil-bin ./usr/bin/ruptime base-netutil-bin ./usr/bin/rusers base-netutil-bin Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1535 src/distrib/sets/lists/comp/mi:1.1536 --- src/distrib/sets/lists/comp/mi:1.1535 Sat Dec 11 10:41:11 2010 +++ src/distrib/sets/lists/comp/mi Sun Dec 12 12:48:31 2010 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1535 2010/12/11 10:41:11 rtr Exp $ +# $NetBSD: mi,v 1.1536 2010/12/12 12:48:31 pooka Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -3322,6 +3322,7 @@ ./usr/libdata/debug/usr/bin/rs.debug comp-util-debug debug ./usr/libdata/debug/usr/bin/rsh.debug comp-netutil-debug debug ./usr/libdata/debug/usr/bin/rump_allserver.debug comp-util-debug debug +./usr/libdata/debug/usr/bin/rump.halt.debug comp-util-debug debug ./usr/libdata/debug/usr/bin/rup.debug comp-netutil-debug debug ./usr/libdata/debug/usr/bin/ruptime.debug comp-netutil-debug debug ./usr/libdata/debug/usr/bin/rusers.debug comp-netutil-debug debug Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1262 src/distrib/sets/lists/man/mi:1.1263 --- src/distrib/sets/lists/man/mi:1.1262 Wed Dec 8 07:20:59 2010 +++ src/distrib/sets/lists/man/mi Sun Dec 12 12:48:32 2010 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1262 2010/12/08 07:20:59 kefren Exp $ +# $NetBSD: mi,v 1.1263 2010/12/12 12:48:32 pooka Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -444,6 +444,7 @@ ./usr/share/man/cat1/rs.0 man-util-catman .cat ./usr/share/man/cat1/rsh.0 man-netutil-catman .cat ./usr/share/man/cat1/rtld.0 man-shlib-catman .cat +./usr/share/man/cat1/rump.halt.0 man-netutil-catman .cat ./usr/share/man/cat1/rup.0 man-netutil-catman .cat ./usr/share/man/cat1/ruptime.0 man-netutil-catman .cat ./usr/share/man/cat1/rusers.0 man-netutil-catman .cat @@ -3221,6 +3222,7 @@ ./usr/share/man/html1/rs.html man-util-htmlman html ./usr/share/man/html1/rsh.html man-netutil-htmlman html ./usr/share/man/html1/rtld.html man-shlib-htmlman html +./usr/share/man/html1/rump.halt.html man-netutil-htmlman html ./usr/share/man/html1/rup.html man-netutil-htmlman html ./usr/share/man/html1/ruptime.html man-netutil-htmlman html ./usr/share/man/html1/rusers.html man-netutil-htmlman html @@ -5656,6 +5658,7 @@ ./usr/share/man/man1/rs.1 man-util-man .man ./usr/share/man/man1/rsh.1 man-netutil-man .man ./usr/share/man/man1/rtld.1 man-shlib-man .man +./usr/share/man/man1/rump.halt.1 man-netutil-man .man ./usr/share/man/man1/rup.1 man-netutil-man .man ./usr/share/man/man1/ruptime.1 man-netutil-man .man ./usr/share/man/man1/rusers.1 man-netutil-man .man Index: src/usr.bin/Makefile diff -u src/usr.bin/Makefile:1.194 src/usr.bin/Makefile:1.195 --- src/usr.bin/Makefile:1.194 Sun Dec 5 17:45:08 2010 +++ src/usr.bin/Makefile Sun Dec 12 12:48:30 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.194 2010/12/05 17:45:08 pooka Exp $ +# $NetBSD: Makefile,v 1.195 2010/12/12 12:48:30 pooka Exp $ # from: @(#)Makefile 8.3 (Berkeley) 1/7/94 .include <bsd.own.mk> @@ -22,7 +22,7 @@ pagesize passwd paste patch pathchk pkill pmap pmc pr \ printenv printf progress pwhash qsubst quota radioctl rdist \ renice rev revoke rfcomm_sppd rlogin rpcgen rpcinfo rs rsh \ - rump_allserver rup ruptime rusers rwall rwho \ + rump_allserver rump_halt rup ruptime rusers rwall rwho \ script sdiff sdpquery sed seq shar shlock \ showmount shuffle sockstat soelim sort spell split stat su systat \ tabs tail talk tcopy tee telnet tftp tic time tip touch tput \ Added files: Index: src/usr.bin/rump_halt/Makefile diff -u /dev/null src/usr.bin/rump_halt/Makefile:1.1 --- /dev/null Sun Dec 12 12:48:33 2010 +++ src/usr.bin/rump_halt/Makefile Sun Dec 12 12:48:31 2010 @@ -0,0 +1,9 @@ +# $NetBSD: Makefile,v 1.1 2010/12/12 12:48:31 pooka Exp $ +# + +PROG= rump.halt + +LDADD+= -lrumpclient +DPADD+= ${RUMPCLIENT} + +.include <bsd.prog.mk> Index: src/usr.bin/rump_halt/rump.halt.1 diff -u /dev/null src/usr.bin/rump_halt/rump.halt.1:1.1 --- /dev/null Sun Dec 12 12:48:33 2010 +++ src/usr.bin/rump_halt/rump.halt.1 Sun Dec 12 12:48:31 2010 @@ -0,0 +1,73 @@ +.\" $NetBSD: rump.halt.1,v 1.1 2010/12/12 12:48:31 pooka Exp $ +.\" +.\" Copyright (c) 1990, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)reboot.8 8.1 (Berkeley) 6/9/93 +.\" +.Dd December 12, 2010 +.Dt RUMP.HALT 1 +.Os +.Sh NAME +.Nm rump.halt +.Nd halt a rump kernel +.Sh SYNOPSIS +.Nm +.Op Fl dhn +.Sh DESCRIPTION +The +.Nm +utility exits a rump kernel. +The file system cache, if present, is flushed. +Since a rump kernel does not control its clients, they are not +directly affected by +.Nm . +However, they will be unable to request further services from the +halted rump kernel. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl d +Create a core dump. +The core file is saved according to standard userland program +coredump rules, and can be later examined with a debugger. +.It Fl h +By default the process hosting the rump kernel exits. +Using this option shuts down rump kernel activity, but does not +cause the hosting process to exit. +.It Fl n +Do not flush the file system cache. +This option should be used with extreme caution. +It can be used if a virtual disk or a virtual processor is virtually on fire. +.El +.Sh SEE ALSO +.Xr rump 3 +.Sh HISTORY +The +.Nm +command appeared in +.Nx 6.0 . Index: src/usr.bin/rump_halt/rump.halt.c diff -u /dev/null src/usr.bin/rump_halt/rump.halt.c:1.1 --- /dev/null Sun Dec 12 12:48:33 2010 +++ src/usr.bin/rump_halt/rump.halt.c Sun Dec 12 12:48:31 2010 @@ -0,0 +1,90 @@ +/* $NetBSD: rump.halt.c,v 1.1 2010/12/12 12:48:31 pooka Exp $ */ + +/*- + * Copyright (c) 2010 Antti Kantee. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +#ifndef lint +__RCSID("$NetBSD: rump.halt.c,v 1.1 2010/12/12 12:48:31 pooka Exp $"); +#endif /* !lint */ + +#include <sys/types.h> + +#include <rump/rump.h> +#include <rump/rumpclient.h> +#include <rump/rump_syscalls.h> + +#include <err.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#define ARGFLAGS "dhn" + +static void +usage(void) +{ + + fprintf(stderr, "usage: %s [-" ARGFLAGS "]\n", getprogname()); + exit(1); +} + +int +main(int argc, char *argv[]) +{ + int ch, flags; + + setprogname(argv[0]); + + flags = 0; + while ((ch = getopt(argc, argv, ARGFLAGS)) != -1) { + switch (ch) { + case 'd': + flags |= RUMP_RB_DUMP; + break; + case 'h': + flags |= RUMP_RB_HALT; + break; + case 'n': + flags |= RUMP_RB_NOSYNC; + break; + default: + usage(); + break; + } + } + + if (optind != argc) + usage(); + + if (rumpclient_init() == -1) + err(1, "init failed"); + + rump_sys_reboot(flags, NULL); + + return 0; +}